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

Francesco Bochicchio bockman at virgilio.it
Fri Jul 4 06:59:39 EDT 2003


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?

Ciao
-----
FB





More information about the Python-list mailing list