How do you create an object from a C++ DLL in C#
-
Hi, I have a c++ DLL it contains a class called MyClass with methods GetName and SetName. [DllImport("MyClass.dll")] public static extern void GetName( string name); This doesn't work because I need to instanciate the class. How do I declare the class and methods within the class? Then how do I instancial the class and call the method? Thanks Mike
-
Hi, I have a c++ DLL it contains a class called MyClass with methods GetName and SetName. [DllImport("MyClass.dll")] public static extern void GetName( string name); This doesn't work because I need to instanciate the class. How do I declare the class and methods within the class? Then how do I instancial the class and call the method? Thanks Mike
No way to do this from C#. Either use MC++, or wrap your class into a COM object and the reference it from your code. I vote pro drink :beer: