Currently, I'm opening and using the library as per the documentation.
However, my server is crashing after a few iterations of my program because
there is no way to close the library after opening it during each iteration
(it runs on a scheduler every 10 minutes). I think I need to be using the
NativeLibrary class since it has the Finalize method, but I can't find any
documentation or examples of how to use it instead of the Library interface.
Can I use the Library interface in conjunction with the NativeLibrary class?
Or are they mutually exclusive? How do I convert the example to use
Here are snippets of my code:
public interface MyLibrary extends Library {
MyLibrary INSTANCE = (MyLibrary)
Native.loadLibrary("/usr/local/lib/MyLibrary.so", MyLibrary.class);
//Some of my library's native methods
void myLib_init();
int myLibCheck(String messageText, PointerByReference emailAddress, String
emailIgnoreList, String key);
//I haven't included all of the methods of my system object to save space
}
And in another class, I call MyLibrary:
myLibrary = MyLibrary.INSTANCE;
myLibrary.myLib_init();
int return = myLibCheck(message, emailAddress, "", keyString);