How to reverse System.loadLibrary in Java

混江龙づ霸主 提交于 2019-12-23 07:58:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!