为什么Python ctypes不能FreeLibrary?

时间:2016-12-21 01:11:18

标签: python python-2.7 ctypes dllexport

>>>h=cdll.LoadLibrary('dll.dll')
>>>h.hello()       # messageBox
1
>>>windll.kernel32.FreeLibrary(h._handle)
1
>>>h.hello()      #and still have messageBox,Why....
1

这是dll源

#include <windows.h>
#define DLL_EXPORT __declspec(dllexport)
BOOL APIENTRY DllMain(HANDLE hModule, DWORD  fdwReason,LPVOID lpReserved)   {}

DLL_EXPORT void hello (void)
{
    MessageBox (0, "Hello World!", "From DLL", MB_ICONINFORMATION);
}

0 个答案:

没有答案