Managed / Unmamaged C++

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marcin Wieczorek

    #1

    Managed / Unmamaged C++

    I'm trying to write a managed DLL that will wrap communications between
    managed and unmanaged c++. All of the unmanaged code is lined to a static
    lib. That lib contains tons of stuff like STL (which is my biggest
    concern ) and other standard C lib stuff. I want to link that static lib
    into the managed DLL. Is that possible?

    So far I've been in linker hell and I can't think straight anymore...

    Thanks,
    Marcin


  • Richard Grimes [MVP]

    #2
    Re: Managed / Unmamaged C++

    In general, yes.

    Managed C++ comes with a technology called IJW that basically allows you to
    call any code compiled in a static lib (or in a DLL with an import lib)
    without any other thunking code. There are namespace issues between the
    types in Win32 and .NET, but these can be solved by careful though of how
    you use using namespace. There are also issues because managed C++ does not
    allow you to declare empty types, for example:

    struct _HIMAGELIST;
    typedef _HIMAGELIST* HIMAGELIST;

    this is take from commctrl.h and is fine as unmanged C++, but it will
    generate an exception at runtime because _HIMAGELIST does not have a body.
    (The solution is just to declare struct _HIMAGELIST{};) .

    There are other issues, but it is possible to solve them.

    Richard
    --
    my email evpuneqt@zicf.b et is encrypted with ROT13 (www.rot13.org)


    "Marcin Wieczorek" <mwieczorek@gap powered.com> wrote in message
    news:uRxacBRXDH A.2632@TK2MSFTN GP09.phx.gbl...[color=blue]
    > I'm trying to write a managed DLL that will wrap communications between
    > managed and unmanaged c++. All of the unmanaged code is lined to a static
    > lib. That lib contains tons of stuff like STL (which is my biggest
    > concern ) and other standard C lib stuff. I want to link that static lib
    > into the managed DLL. Is that possible?
    >
    > So far I've been in linker hell and I can't think straight anymore...
    >
    > Thanks,
    > Marcin
    >
    >[/color]


    Comment

    Working...