<div dir="ltr">Hi Ross,<br><br>Rather than have an application load 30 DLLS (none of which it uses) for the sake of another application which might use as few as just 2 of those 30 and only ever one at a time, why not simply cache each loaded DLL in the application that is actually using them ?<div><br></div><div>I would hope that your function references to the DLL exports are already maintained in a record or even behind a class facade, which would make a cache simplicity itself to implement. If not, introducing such a facade should be straightforward enough.<br><br>With such a cache you still get the initial delay but only for the first use and only for the DLL's actually being used and it eliminates any question about (or possible future variance in) the module loading behaviour of the OS or any problems arising as a result of your "loader" application failing to have loaded at/by the required or expected time etc.</div><div><br></div><div>--</div><div>Jolyon</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 22 September 2015 at 14:42, Ross Levis <span dir="ltr"><<a href="mailto:ross@stationplaylist.com" target="_blank">ross@stationplaylist.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-NZ" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">My automation app loads 1 of perhaps 30 different 3<sup>rd</sup> party DLL’s depending on the job required. It only has to do 1 job at a time and if the job changes (automatically), the current DLL is unloaded and the relevant one is loaded using LoadLibrary. All the DLL’s have the same interface/functions.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">It seems in recent times that the loading of a DLL is taking much too long for many customers, sometimes several seconds, which isn’t acceptable, and it appears to be related to anti-virus software scanning the DLL every time it loads, or at least the first time it has loaded on that day. That seems to vary in different anti-virus software.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">I need to remove that delay. I would rather the main app not load every single DLL at startup as that would take a long time to load, and often only 2 or 3 of the DLL’s will ever be used by a customer.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">There are 2 apps loaded at the same time and rather than altering the app that loads the DLL’s and does all the work, my thought was to have this 2<sup>nd</sup> app load all the DLL’s in the folder using a thread.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">Am I correct that a 2<sup>nd</sup> app loading the same DLL will not actually load the DLL from the hard drive but just access it from RAM, so it should load very quickly?<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">Cheers,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;color:#1f497d">Ross.<u></u><u></u></span></p></div></div><br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" rel="noreferrer" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div>