Connection python with C

vasudevram vasudevram at gmail.com
Sun Dec 24 10:34:41 EST 2006


Fredrik Lundh wrote:
> Χρυσάνθη Αϊναλή wrote:
>
> > I want to connect a script in python with a source code in C. Any
> > ideas about it?
>
> http://docs.python.org/lib/module-ctypes.html
> http://docs.python.org/ext/ext.html
> http://effbot.org/pyfaq/extending-index.htm
>
> </F>

Just a suggestion: another way could be to use XML-RPC. It's a
lightweight distributed computing technology. Python standard library
has an XML-RPC module. I'm not sure, but I think there may be a similar
module for C. I'm almost certain there is one for C++. Try xmlrpc.com
or xml-rpc.com and also Google for appropriate patterns, e.g. "XML-RPC
library for C". Try a few variations on the pattern, that helps.

Yet another way - might be suitable only if your Python script and your
C program can both read/write standard input/output, and one is a
producer and the other is the related consumer.
In this case you can just use:

$ python my_python_script | my_C_binary
or the other way around, as per need.

HTH
Vasudev
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Vasudev Ram
Dancing Bison Enterprises
http://www.dancingbison.com
Check out the cool Snap.com link preview feature
on my site. Free sign-up at www.snap.com
I'm not affiliated with Snap.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




More information about the Python-list mailing list