Archive: Executing function from dll with parameters


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 :(


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.


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


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.


I found http://www.koders.com/c/fid1ABD22E81...C6E8CE6B1.aspx
but it says me nothing.
Please give me short example.


It's in the NSIS source distribution which is on the Wiki.

-Stu


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?


OK, I found this file, but I don't understand how to call my function with parameters.


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