[issue30286] ctypes FreeLibrary fails on Windows 64-bit

2017-05-07 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: > It's documented that the default conversion for integer arguments is a 32-bit > C int. [...] Whenever a pointer is returned, you must set the function's > restype. OK, clear. Closing this out. -- resolution: -> not a bug stage: -> resolved

[issue30286] ctypes FreeLibrary fails on Windows 64-bit

2017-05-05 Thread Eryk Sun
Eryk Sun added the comment: It's documented that the default conversion for integer arguments is a 32-bit C int, which is also the default for result types. Whenever pointers (and Windows handles, which are sometimes 64-bit pointers, such as HMODULE values) are passed as arguments, integer

[issue30286] ctypes FreeLibrary fails on Windows 64-bit

2017-05-05 Thread Giampaolo Rodola'
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 =

[issue30286] ctypes FreeLibrary fails on Windows 64-bit

2017-05-05 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : -- nosy: +amaury.forgeotdarc, belopolsky, meador.inge, theller ___ Python tracker ___

[issue30286] ctypes FreeLibrary fails on Windows 64-bit

2017-05-05 Thread Giampaolo Rodola'
New submission from Giampaolo Rodola': >>> import ctypes >>> path = 'C:\\Python35-64\\vcruntime140.dll' >>> cfile = ctypes.CDLL(path) >>> cfile._handle 140736170229760 >>> ctypes.windll.kernel32.FreeLibrary(cfile._handle) Traceback (most recent call last):