[Tutor] c++ on python

Alan Gauld alan.gauld at btinternet.com
Fri Mar 7 18:53:01 CET 2014


On 07/03/14 14:29, Gabriele Brambilla wrote:

> in the next days  I will receive a c++ code that I would like to run in
> python (http://docs.python.org/2/extending/index.html).

What do you mean?
Are you receiving C++ source code? If so is it for an
executable program, a library or just a single object file?

When you say run it in python do you mean you want to
launch the executable program from Python (see subprocess
module) or call functions in the library (maybe ctypes)
or do you want to to embed the C code as a Python module?

If its an executable to be run via subprocess thats fine
for this list.

If its using ctypes to call functions in a library thats
about the extreme edge of this list.But there is a ctypes
list that is probably more appropriate.

If its embedding the C library as a python module that
is definitely off topic and you should probably try the
main Python list

> It should be self consistent (no extraroutines).

Again I'm not sure what you mean by that.
Do you mean it has no dependencies on other code - not
even glibc? Or just that it is a standalone executable?

> I want to be ready to use it... Has someone some C++ code examples
> available that I can try to run easily before getting that code?

You need to be a lot more specific about what you mean.
What exactly are you trying to do?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list