I have this class that I am importing into SWIG using the %include directive. This class is new’d and deleted by SWIG. On delete, I want the swig layer to call an api prior to deleting the object. How can I specify that in the .i file?


Note: I can’t customize the objects destruction method because I am using this object in other code for other reasons, so I need to somehow only do this custom action when SWIG is deleting the object.