Reputation: 3059
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 .
Upvotes: 3
Views: 3690
Reputation: 595
And you would also need to learn how to marshal types from C++ to C#.
Upvotes: 0
Reputation: 91805
You have to convert any non-standard parameter types (i.e. 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.
Upvotes: 5
Reputation: 36639
The only way I know to do it is to create all the type definitions in C# manually, making sure they are compatible with your dll.
Upvotes: 0