C++ / C# interop

winprofessional 41 Reputation points

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 Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,698 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sam of Simple Samples 5,516 Reputation points

    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.

    0 comments No comments