How to call managed C++ methods from Un-managed C++

前端 未结 2 1379
没有蜡笔的小新
没有蜡笔的小新 2021-01-18 18:23

PLEASE SEE UPDATE BELOW

(RESOLVED) Also I have extended this into a second question here Implement a C# DLL COM File In Unmanaged C++ Program

I have resear

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-18 18:49

    First, your methods receive and return a String^ which is a managed object. Unmanaged code does not know this type, and cannot create such object. So, you will need to wrap the function call such that the function marshal the managed type to something that the unmanaged code can understand.

    After that, you can add the DllExport attribute to the managed method, as discussed here.

提交回复
热议问题