[issue23606] ctypes.util.find_library("c") no longer makes sense

Eryk Sun report at bugs.python.org
Thu Feb 11 04:32:55 EST 2016


Eryk Sun added the comment:

If the examples continue to use printf, then msvcrt.dll is the best option. The universal CRT exports a single Swiss-Army-knife function, __stdio_common_vfprintf, which requires 5 parameters, including a va_list for the variadic argument list. That's not appropriate for a tutorial. We just need a docs update to warn that msvcrt.dll has its own set of file descriptors, heap, and thread-locale state.

> Does it mean `cdll.msvcrt` is not the standard way to access 
> the C symbols anymore?

On a tangent, cdll.msvcrt shouldn't be recommended anywhere in the ctypes docs. All code that uses cdll.msvcrt shares the same restype, argtypes, and errcheck prototypes for each function pointer, which is an unholy mess. The docs should recommend CDLL('mscvrt') or CDLL('msvcrt', use_errno=True). Every module or package should use its own private instance of CDLL.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23606>
_______________________________________


More information about the Python-bugs-list mailing list