|
C++调用C++ DLL- typedef int(*pMax)(int a,int b);
- typedef int(*pMin)(int a,int b);
- typedef void(*pMin2)(int a, int b,int &c);
- typedef void(*pMin3)(char* s1, int a, int b, int &c);
- void main(void)
- {
- HMOUDLE HDLL=LoadLibrary("MyDll.dll");//加载动态链接库MyDll.dll文件;
- if(HDLL != NULL)
- {
- const char* MaxFun;
- pMax MaxFun_ = (pMax)GetProcAddress(hDLL, MaxFun);
- int a = (*MaxFun_)(5,8);
- printf("比较的结果为%d\n",a);
-
- FreeLibrary(hDLL);//卸载MyDll.dll文件;
- }
- }
复制代码
参考:【1】https://www.cnblogs.com/predator-wang/p/4956615.html
|
|