P/Invoke Articles

Call C++ Functions in a DLL using C#

P/Invoke is an efficient method for calling native code functions in an unmanaged DLL. The below code samples show the source code a native code library which defines a very simple C++ function which accepts a char* argument. MyLib.h __declspec(dllexport) int Hello(char* pszBuffer, int nLengthObj); MyLib.cpp #include “stdafx.h” #include “MyLib.h” #include __declspec(dllexport) int SayHello(char* pszBuffer, […]

Read more