question

winprofessional avatar image
0 Votes"
winprofessional asked SimpleSamples answered

C++ / C# interop

Hi, I have a C++ COM dll where some functions have been exported using def file using EXPORTS statement. Now, can I call these COM methods from a C# application? I have done some interop earlier using normal C++ DLLs where the function were exported in extern "C" style. Could you please provide some sample code or link for the EXPORT scenario?

windows-wpf
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SimpleSamples avatar image
0 Votes"
SimpleSamples answered

It is not a COM DLL. I would call it a native DLL. You will use Platform Invoke (P/Invoke) the same as for what you call the extern "C" style. See Platform Invoke Examples. If you can find the header file showing the C signature for the functions then you can use that to create DllImport attributes for them.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.