visual-studio - c#怎么调用c++的类和函数
PHPz
PHPz 2017-04-17 14:21:50
0
2
503
PHPz
PHPz

学习是最好的投资!

reply all(2)
PHPzhong

One way is managed c++, but it may cause major changes to the code.
The other is linking

迷茫

check out C++/CLI (aka managed C++). Write a wrapper that uses your native class as a member

It is best to write a corresponding Interface for each native concrete class used, and use INativeCore instead of NativeCore in Managed C++ to avoid some pitfalls

// in your native core:

// define an interface wrapper for your native core
class INativeCore{
// ...
}
class NativeCore: public INativeCore{
// ... 
}

// in your C++/CLI code
ref public class ManagedClass{
private:
  INativeCore* pCore; // delegate all method calls to native core
public:
  void foo(){
  pCore->foo(); 
}
// ... other methods
}

equivalent SO question

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template