C++函数如下:
// testdll3.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern "C" __declspec(dllexport) int add(int * a,int * b)
{
return *a + *b;
}
C#中动态加载方法:
首先写一个加载DLL文件的类:
以上方法编译.
调用: