Need to wrap object destructors
In same C++ libraries the API may return a pointer to an object for which the user has the responsibility to delete it. This is not possible with the generated wrapper since the destructor is not wrapped. This can be easily done by adding a method delete for each wrapped class.
mod.method("delete", [] (MyClass* ptr) { delete ptr; } );
Meanwhile I have added by hand the destructors I needed. But it would be nice if this could be added in subsequent releases.
@grasph Any progress on this one?
CxxWrap already exports as CxxWrap.CxxWrapCore.__delete() a finalize() c++ method that calls delete().
It defines the method CxxWrap.CxxWrapCore.delete(), that will also set the pointer of the Julia object to zero.
I expect the CxxWrap.CxxWrapCore.delete(), method should be used and there is no need to generate a new one. You may want to wrap it in your module, to list delete under the methods of the module for classes which are expected to be explicitly destructed.
Yes you are right. I can use CxxWrap.CxxWrapCore.__delete(), not CxxWrap.CxxWrapCore.delete() since my object is already a C++ pointer.
Closing the issue.
Not needed
Not needed