Re: DLL hosting

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I don't have control over the host application (SQL Server). The DLL is an
OLEDB provider, I can add it into SQL Server, use it, then remove it from
SQL Server - at this point, SQL Server shouldn't have the DLL loaded but for
some reason it has - however, if I wait around 1 minute, then it unloads it
and I am free to recompile my DLL!

I just need to know why it does this, or if I can force an unload without
restarting SQL Server.

--
Best regards
Mark

"William DePalo [MVP VC++]" <willd.no.spam@xxxxxxxx> wrote in message
news:upIjGxaBGHA.2476@xxxxxxxxxxxxxxxxxxxxxxx
> "Mark" <swozz_@xxxxxxxxxxx> wrote in message
> news:OzkpQ6ZBGHA.1180@xxxxxxxxxxxxxxxxxxxxxxx
>>I am developing a DLL using VS2005 with C++.
>>
>> The DLL is loaded within the host application, I then use "Attach to
>> process" to start debugging. Once I stop debugging, I might modify some
>> code and recompile but the compiler can't write out the .EXE file because
>> it is still loaded by the host application. So I have to shut down the
>> host application to force an unload of the DLL.
>>
>> Is there anyway around this problem?
>
> Well, you can't have your cake and it eat, too. :-)
>
> That is, the code sections in the DLL file can not both be loaded into the
> host process' space and be modified, too.
>
> Of course, if your application is such that you use explicit linking and
> call LoadLibrary() to load it, GetProcAddress() to determine DLL export
> addresses in the host's address space, if you call those exports
> indirectly through a pointer and if when you are done you call
> FreeLibrary() then whenever there have been as many calls to FreeLibrary()
> as LoadLibrary() you will be able modify the file.
>
> Of course, don't expect to call the function until the next LoadLibrary(),
> etc.
>
> Regards.
> Will
>


.



Relevant Pages

  • Re: dllimport to unload dll
    ... I was thinking that when the method (it is a static method) completed then the dll would be unloaded. ... It would be quite annoying to load a DLL, call a function that starts a background thread, and then have the runtime helpfully unload that DLL behind your back, which would either crash the thread or force the DLL to terminate it. ... CLR hosting in SQL Server is subject to pretty serious restrictions precisely because they didn't want just any old code to execute as part of SQL Server itself. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Button list control
    ... can load all DLL's, found in a given directory, and the plug-ins will register themselves for further use. ... Implementing 7zip, or some other new compression format, only requires to add the according DLL to the app's directory. ... The host application can ... the user's commands and parameters back to the plugin. ...
    (comp.lang.pascal.delphi.misc)
  • Re: DLL hosting
    ... working with dll that was injecting into explorer.exe. ... >I don't have control over the host application (SQL Server). ... >>> down the host application to force an unload of the DLL. ...
    (microsoft.public.vc.language)
  • Re: To what degree has it been "broken"?
    ... >host application, which is distributed as open source; ... The vendor signs the DLL using his own private key. ... any tests or has been approved by the test lab. ...
    (sci.crypt)
  • COM Question
    ... If you register a new dll, then it shows up in the ... list as an available device in the various host applications. ... The new app is C#. ...
    (microsoft.public.dotnet.framework.compactframework)