Calling C code from Python

Bill Janssen janssen at parc.xerox.com
Fri Jul 16 21:01:33 EDT 1999


Excerpts from ext.python: 16-Jul-99 Calling C code from Python
meikel at online.de (856*)

> That would probably
> mean that I would have to embed Python into the C-application, make
> the function available to Python (in a magic way?) and then execute a
> script (which has to be a text file on disk) which can call the
> mentioned C-function.

Sounds like the standard Python embedding/extending stuff.  This works
quite well.  You embed Python in your application, then you can use
Python as a scripting language for the application.  Where you need to
call back into C to get various application values, you provide Python
accessors to those values through the standard Python extending
mechanism.  You can also execute Python code from C space quite easily. 
See the document on extending/embedding at http://www.python.org/doc/.

Bill




More information about the Python-list mailing list