[C++-sig] How to load a statically linked boost python module into embedded Python

Andrew Athan aathan_pythoncpp_1542 at cloakmail.com
Wed Mar 8 07:05:10 CET 2006

Perhaps this should be in the manual or FAQ?

I've created a simple boost python wrapper for a C++ class, the code is 
below.  This .o is linked into an application in which I have an 
embedded python interpreter.  How do I expose the TradeObjects module to 
the python code?

I believe the answer is:  Invoke initTradeObjects() after Py_Initialize();



#include <boost/python.hpp>
#include "TradeObjects.h"

using namespace boost::python;

  class_<TTTO::SymbolRef>("SymbolRef",init<const char *>())
    .def("strValue", &TTTO::SymbolRef::strValue)

More information about the Cplusplus-sig mailing list