????????????????????????????????????????DLL?е??????????????????????????????????????????DLL??

???????DLL?е???????????????

????1. ??????????Win32 Dynamic-Link Library???Test

????2. ?????????????Test.h????????????????????£?

//??????
class __declspec(dllexport) CTest
{
...
};
//????????
__declspec(dllexport) void FuncTest();
//????????
extern __declspec(dllexport) CTest  ObjTest;


??????δ????????__declspec(dllexport)????????CTest??????FuncTest?????ObjTest????.cpp??????????????????????????????????????????.dll??.lib??????

???????????????DLL

????1. ??????Win32 ?????

????2. ??????????????.lib??????????????????

????3. ?????????????Test.h(????????????DLL????????)????.h???????????????DLL??.h????и???????????????????£?

#pragma comment(lib?? "test.lib")
//??????
class __declspec(dllimport) CTest
...{
...
};
//??????
__declspec(dllimport) void FuncTest();
//???????
extern __declspec(dllimport) CTest  ObjTest;


???????.h?????dll??.h???????????????#pragma comment(lib?? "test.lib")?????????????????????__declspec(dllexport)?????__declspec(dllimport) ???????Щ???????????????????.h????ж???????????????????? ?????test.dll?е??????????????????Щ?????????????????????????????????????????????????????????????????????.dll??????????????????п????????????????????????

???????????????DLL

????????????DLL???????????????????DLL????????????? .def??????????????????Щ??????????????????????????????????????????.def?????????????:

????LIBRARY    TestImp
????EXPORTS
????ObjTest
????FuncTest

?????????.def????????±???dll?????±???dll???????Dll???ж????????????ù??????????£?

typedef void (*HFUNC)()
HINSTANCE hDLL = LoadLibrary("Test.dll");             //????DLL
if(hDLL)
{
HFUNC hFun = (HFUNC)GetProcAddress(hDLL?? "FuncTest");       //???Dll??FuncTest?????????
if (hFun)
hFun();    //??к???FuncTest
else
...            //??????????FuncTest
}
else
{
//???????
}


?????????????????DLL?к??????????????????????LoadLibrary??DLL?????????У????GetProcAddress?????????????????????????ú?????????????????????????????????????????е??????

????????DLL?ж?????????ù???????????????????DLL???????棬??????GetProcAddress???????????????