Call C function when Java object terminates/finalizes
lille stor <[email protected]> Tue, 29 Dec 2020 10:38:35 +0100
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <trinity-7006663c-fc9f-4241-9abb-6ed6fa2eda03-1609234715546@3c-app-mailcom-bs02> |
Hi,
I have a Java object (created from a Java class generated by SWIG) that when it is about to terminate/finalize, I would like to call a C function to release some resources from the C side of my program. Basically, I would like to extent the following Java method (generated by SWIG) with a call to a C function to release resources (in bold):
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
TestJNI.delete_Pool(swigCPtr);
TestJNI.releaseResource(swigCPtr);
}
swigCPtr = 0;
}
}
Thank you,
L.
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user