Archive: Error: label "CopyJob:" already declared in function


Error: label "CopyJob:" already declared in function
Hi all,

i am using a Macro to create a set of files for one of my setup projects, the macro itself looks like this


!macro _CreateAndCopyC7ClientJob PATH

IfFileExists "$PLUGINSDIR\CLIENTTEMP\C7.zip" CopyJob 0
.
.

CopyJob:
.
.

!macroend
!define CreateAndCopyC7ClientJob `!insertmacro _CreateAndCopyC7ClientJob`


when compiling the setup i get the Message

Error: label "CopyJob:" already declared in function

this macro is called multiple times and the error occurs when its called for the 5th time (3 times out of one nsh, and 2 (before it crashes) out of another nsh file.

I know i can probably work around this if i do not use fixed label but instead "+x" to jump to the desired command.
But i would like to understand why this is happening only when called the 5th time.

Thanks for helping :)

Macros define lines of text that are inserted into your code each time that they are referenced by CreateMacro. The fixed name labels you put into the macro are thus duplicated each time the macro is inserted. This is permissible if the labels are in separate sections or functions, but is an error if the labels are used multiple times in the same function or section.

Instead of relative jumps, you can append a unique modifier onto the label name. Look at some of the header files that use labels (logiclib.nsh) to see how that's done.

Don


Got it, thanks a lot!