RossW
4th November 2006 02:25 UTC
Install Section Call Another?
I'm developing a 3-section installer for custom MS Access programs, each of which uses custom ActiveX components.
Is there a way for each section to call a hidden section which installs the VB runtime .dlls, passing in the name of the app so that the code increments the usage counters per the example on the Wiki? Can I do the same when uninstalling the sections?
kichik
4th November 2006 03:43 UTC
You can define a global label in the section and call it. But why not use a function?
Section
Call :.global_label
SectionEnd
Section
.global_label:
DetailPrint hello
SectionEnd
RossW
4th November 2006 15:20 UTC
A function makes sense, but how do i pass in the name of the component? And will the call to the function by synchronous, i.e. will the rest of the code in the section installer be run only AFTER the call to the function completes?
i.e.
Push "Sec1Component"
Call InstallVB6RuntimeDlls
kichik
4th November 2006 15:43 UTC
Pushing the component name on the stack should work, but why would you need to pass it to the function?
Code in NSIS is ran only synchronously. There's nothing asynchronous in the scripting language.
RossW
4th November 2006 17:18 UTC
The example from the Wiki indicates you need to check if your component/app is already installed:
IfFileExists "$INSTDIR\${CompFileName}" 0 new_installation
StrCpy $ALREADY_INSTALLED 1
Do I need a Return instruction in the function I'm calling or in the installer section? The user manual is a bit confusing ...
kichik
4th November 2006 17:24 UTC
Then you wan to know how to pass parameters to functions? That's easy. Just Push before you Call the function and Pop in the function.
Section
Push "section 1"
Call f
SectionEnd
Section
Push "section 2"
Call f
SectionEnd
Function f
Pop $0
DetailPrint "called from $0"
FunctionEnd
However, if all you want to install is the VB runtime, you don't need to do it from each section. Installing the runtime once for the entire application is good enough. Add an invisible section (nameless) that installs the runtime and you're set.
RossW
5th November 2006 00:59 UTC
I was using an invisible secion originally when I had only 1 app/component, but with the 3 I thought I'd need to call the VB6Runtime function for each so that it updated the shared counter - otherwise, if I uninstalled 1 section it could remove the ActiveX component that the other two appps use.
kichik
5th November 2006 17:52 UTC
If you provide support for installing each component, I'd say the best solution here would be to make the test for the existence of your "application" check for all three components. As long as either of the components is installed, there's no need to update the shared counter when updating and no need to uninstall the VB6 runtimes.