动态链接库的使用
1、添加空项目
2、填写项目名称
3、添加源文件Main.cpp
#include <iostream>
#include <windows.h>
using namespace std;
int main() {
//调用DLL
HINSTANCE hDllInst = LoadLibrary(L"Dll1.dll");
//后边为参数,前面为返回值
typedef int(*PLUSFUNC)(int a, int b);
PLUSFUNC max_number = (PLUSFUNC)GetProcAddress(hDllInst, "max_number");
PLUSFUNC min_number = (PLUSFUNC)GetProcAddress(hDllInst, "min_number");
cout << "最大值为:" << max_number(3333, 44444) << endl;
cout << "最小值为:" << min_number(3333, 44444) << endl;
system("pause");
return 0;
}
4、设置为启动项目,运行