Archive: Do I need to duplicate the function definition to use it in uninstall section?


Do I need to duplicate the function definition to use it in uninstall section?
I have:

Function CloseProgram
Exch $1
Push $0
loop:
FindWindow $0 $1
IntCmp $0 0 done
SendMessage $0 ${WM_CLOSE} 0 0
Sleep 100
Goto loop
done:
Pop $0
Pop $1
FunctionEnd

Function .onInit
Push "Layered"
Call CloseProgram
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
Push "Layered"
Call CloseProgram
FunctionEnd

I get an error:
Call must be used with function names starting with "un." in the uninstall section.


;share Install and uninstall functions
!macro myfunc un
Function ${un}myfunc
Call ${un}someotherfunc
DetailPrint something
FunctionEnd
!macroend

!insertmacro myfunc ""
!insertmacro myfunc "un."



Search this forum and you will find more usefull info.


I get an error:
Call must be used with function names starting with "un." in the uninstall section.
Isn't obvious enough?
Use Function un.CloseProgram or better create a macro.

Thanks onad, that worked. Though this is still dulicating the function only this time by compiler not by me.

Red Wine: please read the original post before replying.