Wrapping unmanaged C++ with C++/CLI - a proper approach

后端 未结 3 954
独厮守ぢ
独厮守ぢ 2020-12-06 12:31

as stated in the title, I want to have my old C++ library working in managed .NET. I think of two possibilities:

1) I might try to compile the library with /clr and

3条回答
  •  天涯浪人
    2020-12-06 13:06

    If you have a lot of unmanaged functions to wrap, you should consider using SWIG. It writes all the wrapper and interop code for you, and has pre-written SWIG interface files that support std::vector, std::string, windows types, etc.

    I have a full example exposing unmanaged C++ DLL functions if you are interested.

提交回复
热议问题