开发者

Calling Unmanaged C++ code from C#

I have zero experience in C++, but have a few years C# experience.

Are there an examples out there showing how I can create a method in a C++ program whic开发者_如何学Goh is then called from a C# program using the DLL?

Cheers


Using p/invoke, you can call C++ code from C#.

Read this: Calling Win32 DLLs in C# with P/Invoke

Another small yet good article : Using P/Invoke to Access Win32 APIs

--

EDIT:

This aritcle explains how to create a DLL library in C and then use it with C#


You can also try compiling the C++ code in Visual Studio to VC++, which is plain old .NET. Avoid the p/invoke, if the code is compatible.


Create some function in C++ with "extern "C"" to avoid the c++ name mangling and then use PInvoke as suggested by Nawaz is the better way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜