There is no sample code for your problem. The message is quite clear you cannot mix managed and unmanaged code in the same project this way. You need to split it into two projects, one which is normal unmanaged C++ and one which is managed and uses the /clr option. Calling Managed Code from Unmanaged Code and vice-versa[^] is a CodeProject article that will help you.
One of these days I'm going to think of a really clever signature.
You may need to create a mixed mode wrapper dll. Create a new CLR class library. Inside that create a new unmanaged class (without the ref keyword) containing static functions. Expose it to your COM dll with the usual unmanaged __declspec macro declaration. Add a Framework reference to the managed dll you want to use.
Make sure the wrapper cpp file uses clr (should be default for managed dll, but check via right-click on cpp file, Properties, C/C++, General, Common Language Runtime support).
You could try to set the same option for one of the cpp files in your COM dll, if it's built in one of the newer VS versions. But chances are it won't work that way because of the incompatibilities you initially mentioned.
Last Visit: 31-Dec-99 19:00 Last Update: 31-Jan-15 4:34