I have created a C++ dll ( let say , MyC++Dll.dll) and I have a header file ( MyC++Dll.h ). MyC++Dll.h contains the types definition .
I want to import this dll in C# application I am creating .
I am able to import the dll using
[DllImport("MyC++Dll.dll")] static extern func();
But I am not able to import/include the header file (MyC++Dll.h) in the C# application which contains the types definition .
Please suggest a way to build this C# application successfully .
You have to convert any non-standard parameter types (ie custom structures, etc.) to C# by hand. Look at http://pinvoke.net for examples of how to do this with Win32 structures. You should be able to figure out how to do this for your own structures.
我知道这样做的唯一方法是手动创建C#中的所有类型定义,确保它们与您的dll兼容。
而且你还需要学习如何编组从C ++到C#的类型。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.