Archive: call !insertmacro twice in a same function


call !insertmacro twice in a same function
Hi,

I defined a macro to check versions of a file. For simplicity, the file is always put into two different fixed directories says "C:\MyApp1" and "C:\MyApp2"

I need to search through the file and get the version, so I wrote a macro:


!macro CheckFileVersion DirToCheck IsRecursive VersionToCheck RET_Code
...
...
...
!macroend


When I call it on another macro, I do:

!macro CheckAllDependencies RET_ResultCode
!insertmacro CheckFileVersion "C:\MyApp1" "True" "1.0.0.1" $0
!insertmacro CheckFileVersion "C:\MyApp2" "True" "2.3038.1102.13" $1
...
...
...
!macroend


When I tried to compile, it says:
Error: label "GoToNextDir:" already declared in function

Both of this macros reside on the same file (which is a common function file, CheckAppFunction.nsh). And will be included on my installer.

Any idea how to tackle this problem? Thanks for any help in advance.

Cheers :)

I found a way to get around this, with the help from this link:
http://forums.winamp.com/showthread....ight=Find+File

Basically, I need to create a function inside a macro. So, in my case it is


!macro CheckFileVersion_Macro UN
Function ${UN}CheckFileVersion_Function
Pop $R0 ;acting as DirToCheck
Pop $R1 ;acting as IsRecursive
Pop $R2 ;acting as VersionToCheck
...
...
...
Push $R9 ;acting as RET_Code
FunctionEnd
!macroend

!macro CheckFileVersion_Macro_Call _UN _DirToCheck _IsRecursive _VersionToCheck _RET_RESULTCODE
Push ${_VersionToCheck}
Push ${_IsRecursive}
Push ${_DirToCheck }
Call ${_UN}IsCPLEXDLLVersionOrNewerExists_Function
Pop ${_RET_RESULTCODE}
!macroend

!macro CheckFileVersion
!define CheckFileVersion '!insertmacro CheckFileVersion_Macro_Call ""'
!insertmacro CheckFileVersion_Macro ""
!macroend

And when you want to use it, you can just simply do:

!insertmacro CheckFileVersion
!macro CheckAllDependencies RET_ResultCode
${CheckFileVersion} "C:\MyApp1" "True" "1.0.0.1" $0
${CheckFileVersion} "C:\MyApp2" "True" "2.3038.1102.13" $1
...
...
...
!macroend


I hope, in the future, anyone who is learning how to use macro can take advantage of this post.

Cheers :)