Ian Goldby
17th May 2006 14:05 UTC
Forcing InstallLib to replace dll?
Is there any way to force InstallLib to replace a DLL even if the replacement does not have a newer version number than the original? This is not a shared DLL, by the way.
In my case, a DLL file version may be unchanged in the new release of the software, but the product version has changed. NSIS doesn't normally try to replace a DLL if the file version is not newer than the existing one. But it doesn't take into account that the product version has increased. The result is that after installation, the old DLL with the old product version is still on the disk.
So I'd like InstallLib to replace the file if the file version is greater than or equal to the existing dll. Is this possible?
Red Wine
17th May 2006 17:23 UTC
See in NSIS manual 4.9.3.5 GetDLLVersion with the given example.
Once you get the version, you can use IntCmp to compare it with a defined version and do what you wish to do, either in case when they are equal, or in cases when the installed version is less/more.
Ian Goldby
18th May 2006 09:05 UTC
Yes, that's how InstallLib does it (except that it uses IntCmpU as the version numbers are unsigned integers).
I was hoping to use InstallLib, because it does extra things like registering DLLs, copy-on-boot, etc.
Red Wine
18th May 2006 12:34 UTC
According to dll's everything you can do with InstallLib you can do it also with GetDllVersion/RegDll/UnRegDll/Reboot Flag etc.
BTW, is it necessary to register a non shared dll?
Ian Goldby
18th May 2006 15:02 UTC
According to dll's everything you can do with InstallLib you can do it also with GetDllVersion/RegDll/UnRegDll/Reboot Flag etc.
Does File automatically replace DLLs that are in use next time you reboot?
According to dll's everything you can do with InstallLib you can do it also with GetDllVersion/RegDll/UnRegDll/Reboot Flag etc.
By register, I mean call the DLL's DLLRegisterServer entry point - i.e. what regsvr32 does. But I don't want to call regsvr32 if there is a built in NSIS function that does this for me - i.e. InstallLib.
I think my best course of action will be to copy the InstallLib macro and modify it for my purposes. Seems like an ugly hack of last resort though...
Red Wine
18th May 2006 17:26 UTC
I think my best course of action will be to copy the InstallLib macro and modify it for my purposes. Seems like an ugly hack of last resort though...
If you insist in "automatically", this is probably a good try :-)
If you prefer to write your own customised code from scratch, then the other method would be more suitable :-)
Ian Goldby
19th May 2006 16:04 UTC
Well, it turned out to be easy to modify the CmpIntU lines in Library.nsh to achieve what I wanted.
Thanks for your help.