16,472
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <Windows.h>
using namespace std;
void main(void)
{
typedef int (*pSum) (int a,int b); //函数指针
pSum Sum = NULL;
HINSTANCE hDLL; //DLL句柄
hDLL = ::LoadLibrary("DllDemo.dll"); //加载动态链接库dll文件
Sum = (pSum)GetProcAddress(hDLL,"Sum");
if(Sum)
{
int temp = Sum(22,22);
cout << temp << endl;
}
FreeLibrary(hDLL);
}