Creating simple c++.net wrapper. Step-by-step

前端 未结 2 1615
我寻月下人不归
我寻月下人不归 2020-11-28 22:38

I\'ve a c++ project. I admit that I\'m a complete ZERO in c++. But still I need to write a c++.net wrapper so I could work with an unmanaged c++ library using it. So what I

2条回答
  •  日久生厌
    2020-11-28 22:54

    http://www.codeproject.com/KB/mcpp/quickcppcli.aspx#A8

    This is general direction. You need to create C++/CLI Class Library project, add .NET class to it (StudentWrapper in this sample), create unmanaged class instance as managed class member, and wrap every unmanaged class function. Unmanaged library is added to C++/CLI project using linker dependencies list, and not as reference. In the Project - Properties - Linker open Additional Dependencies and add .lib name there.

    Note: since we are talking about C++/CLI wrapper, no PInvoke! PInvoke is used to call exported functions (API), and not classes.

提交回复
热议问题