Archive: custom plugin still unloading with SetPluginUnload alwaysoff or /NOUNLOAD


custom plugin still unloading with SetPluginUnload alwaysoff or /NOUNLOAD
I have written a custom plugin that I would like to be kept loaded after the first call.
I am using custom functions Register and Unregister in this way:

Function .onInit
SetPluginUnload alwaysoff
NsisWMPlugin::Register /NOUNLOAD
FunctionEnd

Function .onGUIEnd
SetPluginUnload manual
NsisWMPlugin::Unregister ; NOTE no /NOUNLOAD this time
FunctionEnd

I've added messageboxes in the custom DllMain for ATTACH and DETACH so I can see when the DLL is loaded and unloaded.

If I add loads of calls to custom functions in .onInit then the DLL gets loaded once as I expect but after this function the DLL seems to get loaded/unloaded everytime even though each call has got /NOUNLOAD (which should be unnecessary as I've called SetPluginUnload alwaysoff?
I've tried the call to SetPluginUnload outside .onInit but this doesn't seem to help either.


I have discovered that putting a semi-colon right after '/NOUNLOAD' is bad but haven't done much testing.
It seems to screw up the stack and ignores the /NOUNLOAD flag.

So if you are 'C' programmer and can't live without your semi-colons then put use some white space:

NsisPlugin::MyFunc /NOUNLOAD ; this is a comment


just like "MessageBox mb_ok ab;cd" will show 'ab;cd', this is not a big surprise as the script syntax has no end symbol like C, and only supports one instruction per line