Archive: un.onInit: !define: "D_MYGLOBDEF" already defined in .onInit


un.onInit: !define: "D_MYGLOBDEF" already defined in .onInit
In .onInit I conditionally define a different value for D_MYGLOBDEF - to be used in both install and uninstall sections.

The NSIS script compiles OK with D_MYGLOBDEF in .onInit - and seems to run fine both the installer and uninstaller (although I am not sure that I 100% tested the uninstaller).

But in a recent code review I realized that I don't have a matching un.onInit... so I quickly added one, doing the same conditional !define trick as in .onInit.

The NSIS compiler immediately yelled:

"!define: D_MYGLOBDEF" already defined!
Now I am confused: a !define in .OnInit is valid for uninstall sections as well? :confused:

If so, can I rely on this, eliminating the need to to !define D_MYGLOBDEF in un.onInit for uninstall sections?

Thanks!

A !define is a compile-time command and is valid for the entire script -after- the define was defined. There's really no distinction between installer vs uninstaller as far as defines go :)


Originally posted by Animaether
A !define is a compile-time command and is valid for the entire script -after- the define was defined. There's really no distinction between installer vs uninstaller as far as defines go :)
Thank you - you just confirmed my observation - and helped me discover a misconception in my attempt to conditionally !define in .onInit: a !define should not belong in a function in the first place... it's a compile time thing (duh!)