[C++-sig] Sharing C++ data from different modules

Pierre Barbier de Reuille pierre.barbier at cirad.fr
Thu Oct 2 13:37:02 CEST 2003

I need to build a module for python that will be included in a broader
application with contributions from different teams using different
exporting tools (mainly SWIG or Boost.Python for C++ code, but sometimes
the native C fonctions are used). As we need to share C++ structures, is
there a way to define a function taking a PyObject* that returns a
pointer to the corresponding C++ object. For example, if I have a class
named "MyClass", I'd want to be able to write :

MyClass* ptr = PyObjectToMyClass( py_object );

Where py_object is a PyObject* known to correspond to a MyClass object
exported using Boost.Python.

I hope I'm clear enough,


Pierre Barbier de Reuille

INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP
Botanique et Bio-informatique de l'Architecture des Plantes
TA40/PSII, Boulevard de la Lironde

tel   : (33) 4 67 61 65 77    fax   : (33) 4 67 61 56 68 

More information about the Cplusplus-sig mailing list