grasph / wrapit

Automatization of C++--Julia wrapper generation
MIT License
98 stars 12 forks source link

Need to wrap object destructors #52

Open peremato opened 1 month ago

peremato commented 1 month ago

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; } );
peremato commented 1 month ago

Meanwhile I have added by hand the destructors I needed. But it would be nice if this could be added in subsequent releases.