Is there a reason why Python's ctypes.CDLL cannot automatically generate restype and argtypes from C header files? -
for example, nice able this:
from ctypes import cdll mylib = cdll('/my/path/mylib.so',header='/some/path/mylib.h')
instead of
from ctypes import * mylib = cdll('/my/path/mylib.so') mylib.f.restype = c_double mylib.f.argtypes = [c_double, c_double] mylib.g.restype = c_int mylib.g.argtypes = [c_double, c_int]
my experience python suggests either close has been done , haven't been able find it, or there reason not to. either of these case?
i asked myself same question , before traveled down road far, ran ctypesgen:
http://code.google.com/p/ctypesgen/
it handle of you, although need little learning front. use ctypesgen generate 1 version of python bindings subversion bindings. works well.
Comments
Post a Comment