Ok. Let me clarify (I looked at the link you suggested, but I've not found the answers I was looking for).
There exist a "petsc4py" package, which can be extended using its C API. This package, already exposes PETSc types (and also the Mat type). petsc4py is not programmed using Boost Python. Now, assume I already have a C++ function that takes a Mat parameter; to make it simple, let's take void print_Mat(Mat m) { ... // The implementation is not interesting }; I'd like to expose this function to Python, with a seamless integration mechanism, using Boost Python. Unfortunately, if I use the petsc4py API, I have to expose a wrapper for "print_Mat", in this way: void print_Mat_Wrap(const object& mat_obj) { Mat m( PyPetscMat_Get(mat_obj.ptr()) ); ... // The rest is not important } I don't know anything of the petsc4py implementation, but I know that it already exposes PETSc Mat to Python. I know also that, using the petsc4py C API, the only way to retrieve a Mat from a PyObject* is through the PyPetscMat_Get function, whose signature is this one: Mat (*PyPetscMat_Get)(PyObject *); I know for sure that Mat objects are not allocated with the C++ new operator (I don't know if this is a useful information for you). What I'd really like to do, would be to write a from-Python-converter from a PyObject* (containing a petsc4py exposed Mat) into a Mat, in order to be able to directly expose my "void print_Mat(Mat m)" without writing any wrapper ... but I didn't manage to properly make it ... Is this possible ? 2009/10/26 Randolph Fritz <rfritz...@gmail.com>: > Additional thought. Take a look at: > <http://wiki.python.org/moin/boost.python/PointersAndSmartPointers#OSGexample> > & see if it helps clarify some of the problems. > > -- > Randolph Fritz > design machine group, architecture department, university of washington > rfr...@u.washington.edu -or- rfritz...@gmail.com > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > http://mail.python.org/mailman/listinfo/cplusplus-sig > -- Michele De Stefano http://www.linkedin.com/in/micdestefano http://xoomer.virgilio.it/michele_de_stefano _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig