[Dream] A meta-wrapper module to interface any C dynamic library

Seo Sanghyeon unendliche at hanmail.net
Fri Jul 4 10:56:52 EDT 2003


Use ctypes.

http://starship.python.net/crew/theller/ctypes/

To see is to believe. The following is an actual IDLE session on WinXP.
However, ctypes is cross-platform -- it rusn on Windows, Linux, MacOS X.

>>> import ctypes
>>> loader = ctypes.cdll
>>> dll = loader.msvcrt
>>> sin = dll.sin
>>> sin.argtypes = [ctypes.c_double]
>>> sin.restype = ctypes.c_double
>>> sin(3.14)
0.0015926529164868282
>>>




More information about the Python-list mailing list