Registering LOTS of C level functions

Grant Munsey gmunsey at
Thu Feb 1 09:46:06 EST 2001

I am covering several libraries ... each of which has a couple of thousand
calls (don't ask!).
I would really like some way to be able to register all of them to Python
with one actual
C function and an ID so that inside the C function I can generate the actual
call by using
a data structure that tells the actual functions address and what parameters
it requires.

As it stands I don't see any way to do this without an excessive amount of
trickery. Looks
to me like there is no way to specify an extra parameter to the low level
registration process
for each function ... There is the "self" parameter but that would require
me to allocate a Python
object for each procedure I wanted to cover.

The only thing I can think of at the moment is to generate a bunch of
re-direction procedures ....
Tiny procedures that just get called from Python, add the ID code ... and
then pass on to the
"real" command handler.

Anyone have any suggestions?

More information about the Python-list mailing list