Reputation: 524
I have written a class for easy sound synthesis in C++. This class (let's name it foo) uses the waveOut API. I import winmm.lib and windows.h for the waveOut API to work.
Now I want to export my class foo to a DLL, to use it in C#. There are a lot of definitions from, for example mmeapi.h (I suppose that that's included when I'm including winmm.lib, but I'm just guessing). How can I use the functions and definitions from winmm.lib?
Upvotes: 0
Views: 1071
Reputation: 612954
The easiest way by far to do this is to compile a mixed mode C++/CLI DLL. It is called mixed mode because it mixes managed and unmanaged code.
You can compile your existing C++ class into a mixed mode DLL. Then to export the functionality as a managed class, wrap it up in a C++/CLI ref class. Once you've done that you can add it as a reference in your C# program and it's all good!
Upvotes: 2