|
-
July 17th, 2000, 09:02 AM
#1
Unloading a DLL at runtime?
Is it possible to unload a dll at runtime? When I call a dll for the first time it loads and remains loaded untill the EXE unloads. I want to 'unbind' the dll from the EXE during runtime to free the resources the DLL uses. Is this possible?
Thanks
Jean-Guy
-
July 17th, 2000, 09:09 AM
#2
Re: Unloading a DLL at runtime?
you can (safely) unload a DLL only if you load it explicitly.
1st step: LoadLibrary(Ex) returns handle to the DLL
2nd step: FreeLibrary releases the DLL; requires the handle to the DLL, though (from the 1st step).
-
July 17th, 2000, 09:19 AM
#3
Re: Unloading a DLL at runtime?
How do i do this is Visual basic? Loadlibrary is a C call isn't it?
Jean-Guy
-
July 17th, 2000, 09:23 AM
#4
Re: Unloading a DLL at runtime?
LoadLibrary is an API function that you can call from Visual Basic.
Just get the Declare Statement from the API Declaration Add-In in VB and paste in your VB code.
Then, call it like a VB function
dim h as Long
h = LoadLibrary("yourdllpath")
..
Call FreeLibrary(H)
-
July 17th, 2000, 09:41 AM
#5
Re: Unloading a DLL at runtime?
I have got that part, and used GetProcAddress to get the address now how do I call it?
Jean-Guy
-
August 29th, 2000, 07:16 AM
#6
Re: Unloading a DLL at runtime?
can i also load DLL's made in Visual basic with this function?
I really hope so, because my problems are solved then. I wanted to make an App with plugins (like Winamp)
bye
-
August 29th, 2000, 07:21 AM
#7
Re: Unloading a DLL at runtime?
you can load any 32-bit DLL with LoadLibrary(Ex) and unload it with FreeLibrary.
But, you can't do much with a loaded VB ActiveX DLL.
You need to use CreateObject to instantiate an ActiveX component (it you want to use late binding)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|