[C++-sig] Exposing classes

David Abrahams dave at boost-consulting.com
Wed Jul 27 19:42:18 CEST 2005

"Ira" <sheig222 at gmail.com> writes:

> A question on basics...
> Do all my exposed C++ symbols need to be in .dll format (win32 of
> course)?


> What I mean is, can I have an exe running a python intrpreter where exposed
> symbols are compiled *inside* the exe and somehow be able to access them
> from the python scripts?


> How would I import the modules in such a case?

Just use import in your Python code, but of course your C/C++ code
needs to register the module first.  There's an example of this in the
libs/python/test/ directory.  See embedding.cpp.  The awful Jamfile
incantation needed to build and run it portably is:

    import testing ;

    run ../test/embedding.cpp <lib>../build/boost_python
      : # program args
      : # input files
      : # requirements


Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list