python/C++ wrapper

F

Frank

Hi,

is there anyone here that calls C++ programs from python via swig? It
seems that there are a lot of different ways to do that. For me it
would be important that the original c++ code (which is available)
does not need to be changed and the whole compilation process (swig -
python.... g++....etc) is as simple as possible.

Does anyone have a running example of the following problem:

- A c++ program receives a 2D-matrix from python as input and gives a
2D-matrix as output back to python.

That's all! I would expect there should be someone who actually uses
swig for this kind of problem. If so, could you send me the code, that
would be great!

If it is important, I use linux and numpy.

Thanks,

Frank
 
R

Roman Yakovenko

Hi,

is there anyone here that calls C++ programs from python via swig? It
seems that there are a lot of different ways to do that. For me it
would be important that the original c++ code (which is available)
does not need to be changed and the whole compilation process (swig -
python.... g++....etc) is as simple as possible.

Does anyone have a running example of the following problem:

- A c++ program receives a 2D-matrix from python as input and gives a
2D-matrix as output back to python.

That's all! I would expect there should be someone who actually uses
swig for this kind of problem. If so, could you send me the code, that
would be great!

If this is all you need, than may be you don't need to use any code
generator, but try
some other way: Boost.Python. Take a look on tutorials:
http://www.boost.org/libs/python/doc/tutorial/doc/html/python/exposing.html
 
S

Szabolcs Nagy

- A c++ program receives a 2D-matrix from python as input and gives a
2D-matrix as output back to python.

pyogre uses swig

ogre is a 3d realtime rendering engine written in c++ so there are
many matrix manipulation there and also pyogre does not modify the
original code

cgkit is a computer graphics toolkit written in c++ for python and it
uses boost-python and it uses matrices as well

if you want matrix manipulations in python then you may want to look
into numpy c api
 
S

Szabolcs Nagy

Well, pyogre has few problems with maintenance, and new bindings to
Ogre engine was
created using Boost.Python( http://www.ogre3d.org/wiki/index.php/PyOgre )

oh
last time i played with pyogre they made a transition from boost to
swig :)
so they are back again at boost
(the problem with boost was the slow recompilation time with all the
gccxml parsing and a few other problems which maybe got resolved)

thanks for the info this py++ looks promising
 
F

Frank

I suggest you read the responses to your previous question; also search
the list archives for this month.


Hi Gabriel,

and I suggest you read the question I asked precisely!

Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top