Re: Delete dll

From: alpine (alpine_don'tsendspam_at_mvps.org)
Date: 09/06/04


Date: Mon, 06 Sep 2004 11:05:45 -0600

On Mon, 6 Sep 2004 07:43:27 +0100, "Dave" <dave5398@btinternet.com>
wrote:

>I have a C++ coded (non-COM) dll which I call from a VB exe.
>
>I want to unload the dll after use so I can delete the stored .dll file from
>the hard drive.
>
>How do I unload the dll, or release the file so it may be deleted?
>
>
>Dave

First off, why are you asking a non-COM question in COM and OLE
groups? ;-) For future reference, this type of question would be
better places in an API group.

You can explicitly load the library before calling anything in it
using the LoadLibrary API function and then call the FreeLibrary API
function to free the library when you are finished. This works
because VB will check to see whether or not the library is loaded
before making a call to it and if it isn't already loaded, it will
load it. You could also just call FreeLibrary enough times to unload
the library before attempting to delete it.

In any case, you will want to make sure that you either load a new
version of the library or that you app does not make any further calls
to the library because you will get an error if the library is no
longer present.

HTH,
Bryan
____________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsendspam@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas



Relevant Pages

  • Re: Delete dll
    ... >I want to unload the dll after use so I can delete the stored .dll file from ... >How do I unload the dll, or release the file so it may be deleted? ... You can explicitly load the library before calling anything in it ...
    (microsoft.public.vb.com)
  • C# DLL unloading appdomain
    ... I've finally managed to remotely load a DLL. ... The host application always keeps the entry DLL in memory. ... also unload this main DLL? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How do i dynamicaly load and unload a C# dll at runtime
    ... how do i access methods when the .net assembly was loaded with late biding? ... To unload though you'll need to learn ... When you load a dll, ...
    (microsoft.public.dotnet.framework)
  • RE: OT: Need advice for building large applications.
    ... reflection to load the dll that you are interested in (see the ... replace the test DLLs at runtime and the application will unload the ... >>> You can have a class called Customer, put your method related to customers ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to load a DLL built by MS VC++ in tcl file?
    ... I will invoke the tcl to ... The dll file is generated by the MS Visual C++. ... load the dll to calculate and do some thing, ...
    (comp.lang.tcl)