user162809
user162809

Reputation:

How to reverse System.loadLibrary in Java

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.

Upvotes: 9

Views: 4410

Answers (3)

Alfian
Alfian

Reputation: 5

Try:

FreeLibrary(sdl_library);

Upvotes: -2

sszarek
sszarek

Reputation: 424

JVM will manage unloading library so don't bother yourself :)

Upvotes: 1

Silfverstrom
Silfverstrom

Reputation: 29322

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.

Upvotes: 6

Related Questions