I recently started using SWIG to make C++ code available under Matlab by
generating a Java wrapper that can be called in Matlab.
For basic functionality this works as expected, but boost shared
pointers are giving me some trouble.
For me it is not clear how to dereference the smart pointer to obtain
access to the underlying pointer or object.
Also the smart pointer seems to loose it ability to free memory that is
no longer referenced.
I was under the impression that boost_shared_ptr.i was going to solve al
the memory management issues related the smart pointers and that this
would also create methods to dereference a smart pointer.
Any help and links to examples are appreciated.
Below are samples from my code:
I created a dummy C++ class Angle that contains a method to create a new
PointerAngle smartPtr( new Angle );
In the header file I define:
typedef boost::shared_ptr<Angle> PointerAngle;
In the interface file I include:
%template(SmartPtrAngle) boost::shared_ptr< Angle >;