参考:
Native C++
C/C++ code?
class CNative
{
public:
int NativeFunction(int a) {}
}
C++/CLI
C/C++ code?
public ref class CNativeWrapper
{
private:
CNative *m_pNative;
public:
CNativeWrapper() { m_pNative = new CNative; }
int ManagedMethod(int a) { return m_pNative->NativeFunction(a); }
~CNativeWrapper() { delete m_pNative; }
protected:
!CNativeWrapper() { delete m_pNative; }
}
C#
C# code?
class Program
{
int Main()
{
var nativeWrapper = new CNativeWrapper();
nativeWrapper.ManagedMethod();
return 0;
}
}