Skip to content
⌘ NSIS Forum Archive

$r0

5 posts

Gluck#

$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:



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.
Nutzzz#
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
Gluck#
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.
Nutzzz#
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.