How do I DllExport a C++ Class for use in a C# Application

后端 未结 5 525
独厮守ぢ
独厮守ぢ 2020-12-05 11:37

I have created a C++ Dll project which contains a class \"myCppClass\" and tried to Dll export it using the following code as described by: http://msdn.microsoft.com/en-us/l

5条回答
  •  不知归路
    2020-12-05 12:19

    C# and C++ are NOT ABI compatible like C++ and Delphi, so you cannot export virtual class members (methods) and declare them purely virtual on the calling side an invoke them, because C# cannot handle vtbl's of C++ objects. I would suggest you to wrap your C++ classes by COM, so you have another positive side effect, that other COM compatible languages can use your classes too.

提交回复
热议问题