Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 29th June 2012, 19:42   #1
WindBridges
Junior Member
 
Join Date: May 2011
Posts: 11
Can I call functions dynamically?

I have some strings stored in variables. For example, let $0 = "Foo" and $1 = "Bar". I have two functions that have to be called - MyFuncFoo and MyFuncBar. I have to call these functions by enumerating variables - something like Call "MyFunc$0" and then Call "MyFunc$1". I need such behavior because order of variable's values may vary, and some values may be skipped, so order of function calls will vary too. I know it's not possible to specify function name as string in Call, but may be I can emulate this behavior somehow? or any other way to do that?
WindBridges is offline   Reply With Quote
Old 29th June 2012, 19:58   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,775
GetFunctionAddress (You can also call labels)

IntOp $PostCount $PostCount + 1
Anders is online now   Reply With Quote
Old 29th June 2012, 21:17   #3
WindBridges
Junior Member
 
Join Date: May 2011
Posts: 11
But how can it help if parameter for GetFunctionAddress must be static compile-time string not containing any variables?
WindBridges is offline   Reply With Quote
Old 29th June 2012, 21:39   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,775
The other alternative is a function with just a big switch and it would have to know all the names of the functions...

IntOp $PostCount $PostCount + 1
Anders is online now   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

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