[Dream] A meta-wrapper module to interface any C dynamic library
Thomas Heller
theller at python.net
Fri Jul 4 07:33:27 EDT 2003
"Francesco Bochicchio" <bockman at virgilio.it> writes:
> Hi all,
>
> I was wondering if it would be possible to make a module which allows to
> do something like that:
>
> import c_interface
> math_lib = c_interface.load('math.so', 'math.h' )
> sin_f = math_lib.get_function('sin')
> print "sin(3.14) = %f" % sin_f (3.14)
>
> The idea would be to make a module that allows to use any C dynamic
> library ( I used an hypothetical math.so only as example ) without
> the need of a specific wrapper module.
>
> I've given some thought to this idea, but I was blocked by the theoric (?)
> impossibility to correctly call a C function without knowing its prototype
> at compile time.
>
> Did anybody ever attempted to do something like this?
Yes, it already exists (to some degree).
http://starship.python.net/crew/theller/ctypes/
Thomas
More information about the Python-list
mailing list