Old 26th April 2016, 15:32   #1
cx08
Junior Member
 
Join Date: Apr 2016
Posts: 2
Question nsis error: resolving install function

Sample script:

code:
(--helpers.nsh--)
!define CreateSymbolicLinkFolder "!insertmacro CreateSymbolicLinkFolder"
!ifdef CreateSymbolicLinkFolder_
Function CreateSymbolicLinkFolder_
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"
done:
Pop $R0
Pop $1
Pop $0
FunctionEnd
!endif
!macro CreateSymbolicLinkFolder _JUNCTION _TARGET
!define CreateSymbolicLinkFolder_
Push "${_JUNCTION}"
Push "${_TARGET}"
Call CreateSymbolicLinkFolder_
!macroend

(--sample.nsi--)
!include "helpers.nsh"
...
${CreateSymbolicLinkFolder} "$APPDATA\SOMEPATH" "$EXEDIR\Data"


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

How can i do fix the this?

In this code:

code:
!define CreateSymbolicLinkFolder "!insertmacro CreateSymbolicLinkFolder"
!define CreateSymbolicLinkFolder_
!ifdef CreateSymbolicLinkFolder_
Function CreateSymbolicLinkFolder_
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"
done:
Pop $R0
Pop $1
Pop $0
FunctionEnd
!endif
!macro CreateSymbolicLinkFolder _JUNCTION _TARGET
Push "${_JUNCTION}"
Push "${_TARGET}"
Call CreateSymbolicLinkFolder_
!macroend


if i modify the script like this and if i don't need the macro "CreateSymbolicLinkFolder", nsis give me a warning:
install function "CreateSymbolicLinkFolder_" not referenced - zeroing code
cx08 is offline   Reply With Quote
Old 26th April 2016, 19:54   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,197
I assume this is the same question as you posted on SO? It is a bit hopeless when the errors are in "DeleteLinkOrFolder_" or "Clean" and you don't even show us what those functions look like!

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 27th April 2016, 01:00   #3
cx08
Junior Member
 
Join Date: Apr 2016
Posts: 2
Sorry, the correct source code:

Sample nsis script:

code:
(--helpers.nsh--)
!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"
done:
Pop $R0
Pop $1
Pop $0
FunctionEnd
!endif
!macro CreateSymbolicLinkFolder _JUNCTION _TARGET
!define CreateSymbolicLinkFolder_ ; <--- not work...
Push "${_JUNCTION}"
Push "${_TARGET}"
Call CreateSymbolicLinkFolderFunc
!macroend

(--sample.nsi--)
!include "helpers.nsh"
...
Function Clean
${CreateSymbolicLinkFolder} "$APPDATA\SOMEPATH" "$EXEDIR\Data"
FunctionEnd
Section "Main"
Call Clean
SectionEnd


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
Old 27th April 2016, 01:05   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,197
CreateSymbolicLinkFolder_ is not defined at the top before the !ifdef so the function is never created. Define it before the !include or check my answer on SO for a better way to do this...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
function, macro

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump