Jump to content

  • Log In with Google      Sign In   
  • Create Account

[java] Unloading a DLL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 delphi3d   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 November 2000 - 11:41 PM

I have a Java tool that acts as a plugin to a 3D modeling app. I use JNI for most of the processing that the plugin does. When the plugin is executed, the host app doesn''t terminate its VM (of course), so the JNI DLL remains in memory. Unfortunately, I''d prefer for the DLL to be reinitialized every time the plugin is run. This would make things a lot easier for me. Does anyone know if (and how) I can manually unload a DLL?

Sponsor:

#2 snowmoon   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 November 2000 - 12:27 AM

I may be wrong, but I believe you are at the mercy of the particular VM you are running on. I''m assuming between invocations of the plugin where are no global refrences to it that could be holding open the connection?

You MIGHT be able to use a proxy jni class that manages the loading and unloading for you, but that is idle specualtion.

i.e. implement the same interface and as part of each native source first checks if the DLL is loaded and if not load it. When you session is done ( or with a timier ) unload the .dll with part of the proxy class. The drawback is that you have 2 .dll''s one for the jni stub and the other .dll for the actual work. You also have to manage the .dll loading/unloading yourself.


Good luck

#3 felonius   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 November 2000 - 07:56 PM

You cannot unload DLLs.

However, if you need to do initialization every time it is loaded, why not just call some initialization routine in the DLL when you need it - to reinitialize its contents? There is no reason to put all initilization in DllMain(), besides maybe convenience.

Jacob Marner




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS