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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -