动态加载C++动态库
#include<Windows.h>
#include<iostream>
using namespace std;
typedef int(*Dllfun)(int , int);
void main()
{
Dllfun f;
HINSTANCE hdll;
hdll = LoadLibrary("MyDll.dll");
if (hdll == NULL)
{
FreeLibrary(hdll);
}
f = (Dllfun)GetProcAddress(hdll, "Add");
if (f == NULL)
{
FreeLibrary(hdll);
}
cout << f(1,9);
FreeLibrary(hdll);
system("pause");
}

浙公网安备 33010602011771号