I used NSISArray in some functions in an installer (install sections).
Now when I encapsulate the functions as macros to be able to use them in the
uninstaller too, I get
!error: NSISArray: An array can only be initialised once.Is there an elegant way to use the same user defined function using NSISArray both in installer and uninstaller parts. NSIS requests that uninstaller functions must be preceded by "un."
Code:
!include NSISArray.nsh
${Array} "Devices" 40 5
${ArrayFunc} Inited
${ArrayFunc} Shift
${ArrayFunc} SizeOf
${ArrayFunc} ReadFirst
${ArrayFunc} ReadNext
${ArrayFunc} ReadClose
!ifdef USE_DEBUGGER
${ArrayFunc} Debug
!endif
!macro Init_Devices un
Function ${un}Init_Devices
${Devices->Init}
FunctionEnd
!macroend
!macro Done_Devices un
Function ${un}Done_Devices
${Devices->Inited} 0 empty1
${Devices->Delete}
empty1:
FunctionEnd
!macroend
:
;+ other functions working on array Devices, declared as macros the same way
:
:
; Installer section
!insertmacro Init_Devices ""
; Uninstaller section
!insertmacro Init_Devices "un."