Calling C Function Pointers from Python

Erwin S. Andreasen erwin at andreasen.com
Sun Jul 30 08:19:23 EDT 2000


On Sun, 30 Jul 2000 12:07:59 GMT, Neil Hodgson <neilh at scintilla.org> wrote:

>   I can explain how to use calldll. If you want to know how to write your
>own extensions then you should read the "Extending and Embedding the Python
>Interpreter" document which is part of the standard documentation package
>and should have been installed when you installed Python.
>
>   calldll is a low level Python extension libary which contains functions
>for creating buffers, loading DLLs, finding the address of functions within
>the loaded DLLs, and calling the functions. On top of that is a higher level
>windll module that makes it more convenient to call.

Interesting -- it should be possible to create a similar module for loading
shared objects under UNIX and calling functions in those. Although it wouldn't
be that easy, since you would need to find a way to call a function pointer
with a variable number of arguments in C.

Has anyone created something like this? Is there any interest in it? It would
allow interfacing to shared libraries without needing to compile a C-module or
having to get a compiled C module just for your specific architecture (at the
expense of some speed, of course).

Of course, such a module would hae to be part of the standard Python for it to
be really useful :)


-- 
=======================================================================
<erwin at andreasen.com>           Herlev, Denmark       Software Designer
<URL:http://www.andreasen.org/>       <*>                LASAT Networks
=======================================================================



More information about the Python-list mailing list