How to define a callback from Python to a C program ...
Markus Schaber
markus at schabi.de
Wed Aug 15 14:56:59 EDT 2001
Hi,
Marten Feldtmann <marten at toppoint.de> schrub:
> I want to extend my application (not written in C) with Python and
> I want to call from Python to my program and give my program some
> information (say a string) ... it's something like a callback.
>
> Can this be done ???
If the language your application is written lets you execute external
programs, than you can use pipes. Start the python program from your
application, and then communicate with it through the pipes.
Java e. G. has java.lang.runtime and java.lang.process. This allows you
to start an external process, and access the process's stdin, stdout
and stderr like files.
The second way - at least with unixoid OSes - would be to use named
pipes.
If both fails, you could open a tcp or udp socket, and communicate this
way.
markus
--
1) Customers cause problems.
2) Marketing is trying to create more customers.
Therefore:
3) Marketing is evil. (Grand Edwards in comp.lang.python)
More information about the Python-list
mailing list