Giampaolo Rodola' added the comment: http://stackoverflow.com/questions/23522055/error-when-unload-a-64bit-dll-using-ctypes-windll
Adding "ctypes.windll.kernel32.FreeLibrary.argtypes = [wintypes.HMODULE]" fixes the issue. This works: import ctypes from ctypes import wintypes path = 'C:\\Python35-64\\vcruntime140.dll' cfile = ctypes.CDLL(path) print(cfile._handle) ctypes.windll.kernel32.FreeLibrary.argtypes = [wintypes.HMODULE] ctypes.windll.kernel32.FreeLibrary(cfile._handle) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30286> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com