Tech Off Thread

7 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Win32 from a Managed C++ DLL

Back to Forum: Tech Off
  • User profile image
    brussell

    Anyone know (if it is possible) how to expose a Win32 interface from a Managed C++.NET DLL?

    I have a program that requires the DLL to be Win32. However, I need to write a Managed .NET DLL and get it to work. I need it to appear as though it is a Win32 DLL to the program.

    Any reference or information would be greatly appreciated.

  • User profile image
    Sven Groot

    Just export functions as you normally would in an unmanaged DLL (create a def file). You don't need to do anything special, it just works.

  • User profile image
    brussell

    Sven Groot wrote:
    Just export functions as you normally would in an unmanaged DLL (create a def file). You don't need to do anything special, it just works.


    Wow, that sounds too easy. I'll give it a try, thanks.

  • User profile image
    Sven Groot

    Check the source of C9Music for an example. Both the PluginGlue and the WinampPlugin DLL are managed DLLs, but export normal functions so that the WMP plugin and Winamp respectively can access them.

    Although these are written in C++/CLI, it works exactly the same with the older Managed C++.

  • User profile image
    brussell

    Thanks, it really was that easy. I thought I was going to be spending a while researching that today.

  • User profile image
    brussell

    I'm having a bit of a problem with a crash when debugging.

    I have a Managed DLL that I wrote for a test program that uses Win32 DLLs

    I can run the test program and it will use the functions in my Managed DLL just fine.

    However, if I am using the Managed DLL project to debug when the DLL loads, Visual Studio crashes.

    Any ideas???

    I can debug Win32 DLLs in their project just fine.
    I can also attach the debugger for this Managed DLL fine after the DLL has been loaded, but none of my breakpoints get hit when I call funcitons on the DLL...

  • User profile image
    brussell

    For an update in case anyone was curious, it must have been some problem with that specific project.

    I created a new project and put the code in that one and everything works great.

    Thanks for the help.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.