SWIG and Python in use?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alan Sheehan

    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 "applicatio n 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

    #2
    Re: SWIG and Python in use?

    Hi,

    Alan Sheehan wrote:
    [color=blue]
    > I am considering scripting a large C++ application.
    >
    > In particular I am interested in test driving and end-user scripting
    > the "applicatio n 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 ?[/color]

    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

    Comment

    Working...