问题
I am writing a JNI program and I want to unload the dll after i hava finished using it.
What can I do for this purpose? I couldn't find a unloadLibrary()
method in the Javadoc.
回答1:
There is no direct way of manually unloading your dll.
Put simply, your dll will be unloaded when the ClassLoader of the Class that loaded your jni-dll is handled by the garbage collector.
回答2:
JVM will manage unloading library so don't bother yourself :)
回答3:
Try:
FreeLibrary(sdl_library);
来源:https://stackoverflow.com/questions/1433155/how-to-reverse-system-loadlibrary-in-java