Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   SWIG and Python in use? (http://www.velocityreviews.com/forums/t319347-swig-and-python-in-use.html)

Alan Sheehan 07-07-2003 02:40 PM

SWIG and Python in use?
 
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

Wolfgang 07-08-2003 08:58 AM

Re: SWIG and Python in use?
 
Hi,

Alan Sheehan wrote:

> 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



All times are GMT. The time now is 07:02 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57