import ctypes
# get the module handle and create a ctypes library object
libHandle = ctypes.windll.kernel32.LoadLibraryA('mydll.dll')
lib = ctypes.WinDLL(None, handle=libHandle)
# do stuff with lib in the usual way
lib.Foo(42, 666)
# clean up by removing reference to the ctypes library object
del lib
# unload the DLL
ctypes.windll.kernel32.FreeLibrary(libHandle)
我发现唯一真正有效的方法是负责调用
LoadLibrary
和FreeLibrary
。像这样:相关问题 更多 >
编程相关推荐