rsegal
4th December 2003 20:43 UTC
Problem calling DLL function using System plugin
So I have a function in the following format,
int MyFunc(LPCTSTR param1, LPCTSTR param2)
That I want to call using the System plugin. Seems simple enough right? This is how I'm calling the function
System
::Call'MyDLL::MyFunc(t"Hello",t"Goodbye")ir2'
However when I print out the contents of $2 all I get is a blank string when it should be an integer equal or greater than 0. Is there any way I can check whether the DLL is acutally getting called by the script? I think I've got the syntax right but I've never used the System DLL before so I'm not sure.
kichik
4th December 2003 21:17 UTC
You forgot a dot before r2. It should be:
System::Call 'MyDLL::MyFunc (t "Hello", t "Goodbye") i .r2'
The dot means the return value doesn't need an input. Each parameter specification, including the return value consists of type, input and output. If you want to skip input or output you put a dot. If it's the output, you can also not put anything there.
rsegal
4th December 2003 21:58 UTC
Ok so I added in the dot, now my function returns "error" as it's return value. Is this something the System plugin will return or is that returned by the function I'm calling.
Also does the DLL I'm calling need to be in a specific folder for it to be called. Say the Windows system directory?
rsegal
4th December 2003 22:12 UTC
Problem averted. Everything worked once I switched the call to
System::Call '$SYSDIR\MyDLL::MyFunc (t "Hello", t "Goodbye") i .r2'
As the DLL I want to call is in the windows system directory.