Old 28th April 2018, 11:14   #1
Gluck
Member
 
Join Date: Apr 2018
Posts: 72
$r0

Sorry if I'm silly, but I'm a newbie and I'm learning...

Often I see code like this:

${registry::RestoreKey} "$EXEDIR\portable\Registry.reg" $R0

I have read that $R0 is a variable:

http://nsis.sourceforge.net/Docs/Chapter2.html

But I haven't understood the sense and the use...

What means "shared code" and what refer?
Why this line is shared???
What contain $R0???

I know Visual Basic .NET, so I know something...

Thanks.
Gluck is offline   Reply With Quote
Old 28th April 2018, 20:53   #2
Nutzzz
Junior Member
 
Join Date: May 2007
Location: Orange County, CA, U.S.A.
Posts: 45
You need to read a bit further in the scripting reference manual you linked to read about registers: http://nsis.sourceforge.net/Docs/Chapter4.html#varother

Shared just means something you've !include'd that contains general purpose functions not specific to your installer.

If you're writing your own macros and functions, read further to deal with the related issue (since you don't want to tromp all over registers that code outside a function is using) of stack handling: http://nsis.sourceforge.net/Docs/Cha...html#stackinst
Nutzzz is offline   Reply With Quote
Old 29th April 2018, 08:49   #3
Gluck
Member
 
Join Date: Apr 2018
Posts: 72
So shared variables are different from Public Var in VB.NET...

I'm learning how to use NSIS for portabilize, not for install, so I don't know the rules to create an installer.


If I have this code:

${registry::SaveKey} "${REGKEY1}" "$EXEDIR\Data\${APP1}.reg" "/A=1" $R0
Sleep 200

${registry::SaveKey} "${REGKEY2}" "$EXEDIR\Data\${APP2}.reg" "/A=1" $R0
Sleep 200

In the second call I have to use $R0 or $R1???
Can be a conflict?

Thanks.
Gluck is offline   Reply With Quote
Old 30th April 2018, 17:43   #4
Nutzzz
Junior Member
 
Join Date: May 2007
Location: Orange County, CA, U.S.A.
Posts: 45
It's fine to use $R0 in both places. You use registers as temporary variables. Do with it as you will. In this case, you're not even using it, so it doesn't really matter what you call it.

As I said, the register and stack management issues come when you are writing your own functions or macros because you need to save the contents of the registers before you use them, then restore them to their original state, since they might need to be used after execution is returned at the end of the function or macro.
Nutzzz is offline   Reply With Quote
Old 30th April 2018, 18:49   #5
Gluck
Member
 
Join Date: Apr 2018
Posts: 72
ok, thanks.
Gluck is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast 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