Message380688
A function that returns a pointer needs an explicit `restype` set. A function parameter that's a pointer generally requires `argtypes` to be set. For example:
_testdll.GetPointer.restype = ctypes.c_void_p
_testdll.SetPointer.argtypes = (ctypes.c_void_p,)
Unfortunately the ctypes documentation starts with a tutorial that promotes bad practices and misuses WinAPI GetModuleHandle multiple times, which gives people the wrong idea about pointer return values. However, the tutorial does mention that Python integers are passed as C int values by default and that C int is the default return type. It also shows how to use the `argtypes` and `restype` attributes. |
|
Date |
User |
Action |
Args |
2020-11-10 16:46:38 | eryksun | set | recipients:
+ eryksun, sh4dow |
2020-11-10 16:46:38 | eryksun | set | messageid: <1605026798.76.0.706741221085.issue42311@roundup.psfhosted.org> |
2020-11-10 16:46:38 | eryksun | link | issue42311 messages |
2020-11-10 16:46:38 | eryksun | create | |
|