View Single Post
Old 27th April 2016, 01:00   #3
Junior Member
Join Date: Apr 2016
Posts: 2
Sorry, the correct source code:

Sample nsis script:

!define CreateSymbolicLinkFolder "!insertmacro CreateSymbolicLinkFolder"
!ifdef CreateSymbolicLinkFolder_ ; <--- always false
Function CreateSymbolicLinkFolderFunc
Exch $0 ; _TARGET
Exch 1
Exch $1 ; _JUNCTION
IfFileExists "$0" 0 done
${GetParent} "$1" $R0
CreateDirectory "$R0"
System::Call "kernel32::CreateSymbolicLinkW(w `$1`, w `$0`, i 1) i .s"
Pop $R0
Pop $1
Pop $0
!macro CreateSymbolicLinkFolder _JUNCTION _TARGET
!define CreateSymbolicLinkFolder_ ; <--- not work...
Push "${_JUNCTION}"
Push "${_TARGET}"
Call CreateSymbolicLinkFolderFunc

!include "helpers.nsh"
Function Clean
${CreateSymbolicLinkFolder} "$APPDATA\SOMEPATH" "$EXEDIR\Data"
Section "Main"
Call Clean

Nsis error:
Error: resolving install function "CreateSymbolicLinkFolderFunc" in function "Clean"
Note: uninstall functions must begin with "un.", and install functions must not

How can i define CreateSymbolicLinkFolder_ correctly in macro CreateSymbolicLinkFolder?
The "!ifdef CreateSymbolicLinkFolder_" code is to avoid nsis warning, when i don't need to call the macro CreateSymbolicLinkFolder:
install function "CreateSymbolicLinkFolder_" not referenced - zeroing code

Last edited by cx08; 27th April 2016 at 01:58. Reason: simplify matters
cx08 is offline   Reply With Quote