c567591
20th January 2005 17:50 UTC
Delphi Plugins
Ok, I know I am being a dumbass, but I can't get a Delphi dll that I am writing to work.
The delphi function call is:
function GetProductInt(SerialNo, Key:String): Integer; cdecl;
Using the System plugin:
SYSTEM::Call 'Project1::GetProductInt(t, t)i (r0, r1) r2'
$R0 and $R1 have the text strings that I am trying to pass to the function, so that looks ok.
As soon as I call it, I get an error from XP saying it has caused and error and now needs to close. I don't think it is doing anything in my function yet. i have tried to write the SerialNo and Key to a file in my Delphi function to check them and I tried outputting them via message box and still I cant get anywhere.
I looked at the example plugin and I did not understand what I was supposed to pass to the EXDll example plugin to do this as a plugin. What do I put in the nsis script to call the example plugin?
kichik
20th January 2005 18:11 UTC
Your System::Call line is missing a dot before 'r2'. But that's not why it crashes. It might have crashed because you're using the wrong calling convention. You need to use stdcall, not cdecl.
To use a plug-in, put the DLL in the Plugins folder, and use it just like you use the System plug-in:
PluginName::FunctionName parameter1 "parameter 2"
c567591
20th January 2005 18:16 UTC
Ok, I will try that an report back what happens.
As far as a plugin version goes, there is no initialization that needs to occur or anything? Or does nsis handle that?
kichik
20th January 2005 18:57 UTC
Initialization of what? The ExDLL.pas example shows everything that needs to be done on the plug-in side.
c567591
20th January 2005 19:21 UTC
How do I call it from the nsis script?
EXDLL::ex_dll
How do I get hwndParent: HWND parameter to send it?
procedure ex_dll(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer); cdecl;
kichik
20th January 2005 19:24 UTC
All of those parameters are passed by NSIS. In your script, the bare minimum is:
ExDLL::ex_dll
If you wish to send some stack parameters, add them on the same line, just like with the System plug-in call.