How to use interface pointer exported by C++ DLL in C#
问题 I have a DLL written in C++, which exports a function CreateRisk. The function returns an interface pointer, as follows: extern "C" { __declspec(dllexport) IRisk* __stdcall CreateRisk() { return new Risk(); } } IRisk is derived from IUnknown and has a custom method Calculate: class IRisk: public IUnknown { public: virtual int __stdcall Calculate(int i,double s) = 0; }; the class Risk implements IRisk interfaces (the implementation is omitted here). What I want is to call the function