View Single Post
Old 4th September 2008, 02:11   #26
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Quote:
Originally posted by claesabrandt
LoRd_MuldeR, regarding making a Destroy function. I am not quite sure what to put in that function.[/B]
The important thing is, that you call your Plugin one time *without* the "/NOUNLOAD" option, before the installer exists. Otherwise the DLL won't be freed and thus cannot be deleted. If you don't have any resources to free inside your DLL, simply implement a dummy "Destroy" method. Sidenote: Calling the plugin with /NOUNLOAD will prevent the DLL from loosing it's "internal" state after every single call. It will also prevent the DLL from being re-initialized at/before very single call...

Quote:
Originally posted by claesabrandt Another thing. Is there a way to get to know how many parameters I have passed in, so I can skip passing in the int with number of parameters?[/B]
Nope, you cannot. NSIS arguments are simply passed on the NSIS stack and your plugin MUST know how many arguments it has to pop off the stack. I highly recommend you don't let the user call your plugin directly! Provide some macros instead. This makes it much safer and much more easy to use as well!

code:
!macro _CallCRL dll namespace class method args
CLR::Call /NOUNLOAD `${dll}::${namespace}::${class}::${method}(${args})`
!macroend

!define CallCRL "!insertmacro _CallCRL"

code:
Section
${CallCRL} "SomeAssembly.dll" "SomeNamespace" "SomeClass" "SomeMethod" '"some string value",12,"15.8",false'
SectionEnd


My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote