bigbluestranger
22nd June 2006 10:20 UTC
Executing function from dll with parameters
Hi,
I have a following problem:
I'm creating install program and I use some functions from external dll library.If one of my function in dll library has no parameters it works correctly.
But I have to use function with parameter:
void foo(int i)
{
....
};
I do not really know how to call this function from my nsi file(nullsoft installer script).
Please help me.
I'v tried this ways:
VComInstaller::SetMUXPORTNAMERegistryKey 2
VComInstaller::SetMUXPORTNAMERegistryKey $2
VComInstaller::SetMUXPORTNAMERegistryKey "2"
It doesn't work :(
bigbluestranger
22nd June 2006 10:33 UTC
I've tried do it this way too:
StrCpy $0 2
System::Call ' VComInstaller::SetMUXPORTNAMERegistryKey(i r0)'
Without good result ;-(.
It doesn't call my function.
Mr Inches
22nd June 2006 12:02 UTC
The first version will only work with plug-ins, so your library needs to be expecting parameters to be passed to it by NSIS.
The ExDLL header file (Contrib\ExDLL\ExDLL.h) details how parameters are passed to a plugin and how a plugin can access the stack or NSIS variables. Your library needs to be in the $PLUGINSDIR to work this way too.
The second form only works the other way, if your library is NOT a plug-in and expects to be called like a normal DLL.
Duncan
bigbluestranger
22nd June 2006 12:13 UTC
I haven't this file ;-( ExDLL.h
Could You print it or send me marcin.bukowski@NOSPAMgmail.com
Please remove NOSPAM from my email.
Thanks.
bigbluestranger
22nd June 2006 12:17 UTC
I found http://www.koders.com/c/fid1ABD22E81...C6E8CE6B1.aspx
but it says me nothing.
Please give me short example.
Afrow UK
22nd June 2006 12:17 UTC
It's in the NSIS source distribution which is on the Wiki.
-Stu
bigbluestranger
22nd June 2006 12:31 UTC
I have this version but in my Contrib folder are only
5 subfolders and ExDLL doesn't exist.
Additionally i've done search for ExDLL.h file and it doesn't exist too. ;-(
So where is the problem?
bigbluestranger
22nd June 2006 12:34 UTC
OK, I found this file, but I don't understand how to call my function with parameters.
Afrow UK
22nd June 2006 13:42 UTC
You use the stack to pass it data, using popstring(buff).
You need to use atoi to convert it to an integer if necessary (or use my_atoi which you can find on Google).
-Stu