??????????DLL?????DLL
????????? ???????[ 2010/5/28 11:34:15 ] ????????
????????????????????????????????????????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???????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11