zxpat...@gmail.com, 11.03.2011 23:16:
On Mar 11, 2011 4:59pm, Dan Stromberg wrote:
On Fri, Mar 11, 2011 at 1:15 PM, Patrick wrote:
I saw in the Beginner document that "•Is easily extended by adding new
modules implemented in a compiled language such as C or C++. ".
While to my investigation, it seems not that easy or did I miss
something?
boost python (C++ libraries need to be re-compiled with written
wrappers again?).
SWIG (It works by taking the declarations found in C/C++ header and
using them to generate the wrapper code that scripting languages need
to access the underlying C/C++ code).
I guess it should be asked: "easy for who"? "easy" is always relative to
some context.
If you're planning to stay with CPython and C++ forevermore, then Cython
is a nice way of gluing the two. Cython looks like Python code, but it
gives you access to C and C++ code and data as well as CPython code and
data.
Thanks for the info. Really I was hoping for a "non-intrusive" way to
expose existing C++ libraries to python. However, both solutions (BOOST,
SWIG) listed here require the recompilation of libraries?! Seems Cython is
doing the similar way?
Neither of the three requires the *re*compilation of libraries, but they
all require you to compile wrapper code. As Dan pointed out, Cython has
likely the lowest entry bar while giving you all freedom to design a
suitable wrapper. It's also the fastest of the three.
It is ok for small applications but will be hard for
big software from big companies. The reason is that even companies are
willing to rebuild their own libraries with those wrappers or decorations
added(though needs approves from all sorts of departments :)), they can't
force their 3rd-party developers/users.
Correct me if I am wrong.
You can use the libraries as they are shipped, no need to change them.
Stefan
--
http://mail.python.org/mailman/listinfo/python-list