SWIG and Python in use?

A

Alan Sheehan

Hi,

I am considering scripting a large C++ application.

In particular I am interested in test driving and end-user scripting
the "application layer" in Python and giving it access to a large
collection of C++ objects and their methods.

I note that SWIG is a mature tool and refers to supporting Python
v1.x.

Has/Does anyone use SWIG to bind with Python 2.x ?.

Does it still work?
Any pitfalls, caveats ?

Thanks in advance.

Alan
 
W

Wolfgang

Hi,

Alan said:
I am considering scripting a large C++ application.

In particular I am interested in test driving and end-user scripting
the "application layer" in Python and giving it access to a large
collection of C++ objects and their methods.

I note that SWIG is a mature tool and refers to supporting Python
v1.x.

Has/Does anyone use SWIG to bind with Python 2.x ?.

Does it still work?
Any pitfalls, caveats ?

I've used swig a little bit. It's very good to generate interfaces for
C librarys. It can build interfaces for a lot of languages not only
python.

To interface C++ there are some problems. Simple C++ clases are easy
to interface but if us use virtual methods, templates an so on that
possible with swig but you have to write a lot of wrapper code.
Not an easy task.

To interface the app to python 2.2 and above, consider to use
Boost.python: http://www.boost.org/libs/python/doc/index.html

Today I use Boost.python for my new projects. It's easy
to interface C++ librarys and all C++ stuff.
Less code to write and for me it's easier.
(I don't know the Python C Api in detail, with boost.python
I wrote a C++ interface for a database within 3 days)


bye by Wolfgang
 

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
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top