Dan,
<br />
<br />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? 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. 
<br />Correct me if I am wrong. 
<br />
<br />Rg,
<br />-Patrick
<br />
<br />On Mar 11, 2011 4:59pm, Dan Stromberg <drsalists@gmail.com> wrote:
<br />> 
<br />> On Fri, Mar 11, 2011 at 1:15 PM, Patrick zxpatric@gmail.com> wrote:
<br />> 
<br />> 
<br />> Hi,
<br />> 
<br />> 
<br />> 
<br />> 
<br />> 
<br />> I saw in the Beginner document that "•Is easily extended by adding new
<br />> 
<br />> 
<br />> modules implemented in a compiled language such as C or C++. ".
<br />> 
<br />> 
<br />> 
<br />> 
<br />> 
<br />> While to my investigation, it seems not that easy or did I miss
<br />> 
<br />> 
<br />> something?
<br />> 
<br />> 
<br />> 
<br />> 
<br />> 
<br />> boost python (C++ libraries need to be re-compiled with written
<br />> 
<br />> 
<br />> wrappers again?).
<br />> 
<br />> 
<br />> SWIG  (It works by taking the declarations found in C/C++ header and
<br />> 
<br />> 
<br />> using them to generate the wrapper code that scripting languages need
<br />> 
<br />> 
<br />> to access the underlying C/C++ code).
<br />> 
<br />> I guess it should be asked: "easy for who"?  "easy" is always relative to some context.
<br />> 
<br />> 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.
<br />> 
<br />> 
<br />> 
<br />> If you're planning to support your C++ code with more languages than CPython, you might be better off with SWIG.
<br />> 
<br />> If you really do want to do the task the old way, you're probably best off copying some preexisting module with a maximize-the-developers-rights license (like Apache, MIT or 3 clause BSD), and modifying that.
<br />> 
<br />> 
<br />> 
<br />> If you want to be able to move easily to pypy, I might suggest coming up with a C wrapper for your C++ code, and then accessing the C code using ctypes.  That should work in CPython and pypy, and it looks like jython might support this soon as well.
<br />> 
<br />> 
<br />> 
<br />> 
<br />> 
<br />> 
<br />> 
<br />> 
<br />>