动态加载动态链接库


动态加载动态链接库

使用函数:
HINSTANCE hInst;
hInst = LoadLibrary("Dll3.dll");
typedef int (* ADDPROC)(int a,int b);

ADDPROC Add = (ADDPROC)GetProcAddress(hInst,"add");
//ADDPROC Add = (ADDPROC)GetProcAddress(hInst,MAKEINTRESOURCE(1));
if(!Add)
{
    return;
}
CString str;
str.Format("5+3 = %d",Add(5,3));
MessageBox(str);
FreeLibrary(hInst);