Archive: Structured parameter


Structured parameter
Hi, I have a C++ DLL with 2 params, one is structured. I call my function with System:
System::Call 'MyLib::NfoUsr(t "OReally", t .r1)'
My lib fill r1 with a structure like this:
struct Vendor
char Name
char Surname
char Address
int Products
after library calling I use:
System::Call "*$1(&t .r2, &t .r3, &t .r4, i .r5)"
but only $2 is filled with information.

The DLL fill data with strcpy(vendor->Name, sNfo.Name);

Please help me, best regard


your struct string members probably are char*Foo or char Foo[somesize] and not just a single char

There is an example that allocates/calls/reads a struct in /NSIS/Docs/System/System.html (in the FAQ part)


If it's a pointer to a string and not the string itself, remove the ampersands. If not, specify the string sizes after `&t`.


Tanks for your suggestions, but I still have the problem.
I try to explain with more details.
In MyLib I have this structured param:

struct Vendor
{
char sName[52];
char sSurname[36];
char sAddress[32];
char sCity[4];
char sZIP[8];
char sIDKey[20];
char sLabel[32];
char sKey[12];
long lNumber; //4 BYTES
}

This structure is filled with strcpy(vendor->Name, sNfo.Name);

This is a snip of NSIS code:
Pop $1
Pop $0
System::Call 'MyLib::Open() i .r1'
System::Alloc 200
System::Call "*(t, t, t, t, t, t, t, t, i)t.r0"
--------
System::Call 'MyLib::NfoUsr(t "OReally", t .r0)'
;Dumpstate::debug
System::Call "*$0(t .r1, t .r2, t .r3, t .r4, t .r5, t .r6, t .r7, t .r8, i .r9)"
Dumpstate::debug
------
System::Call 'MyLib::Usr(t "OReally", t .r1, t .r2)'
Dumpstate::debug

In the first call (NfoUsr) I have only a result in $0 with or without dimension of param, instead in the second one (Usr) MyLib return
all param correctly filled up.
In an other post I have read that in some cases it is necessary to split the strings with the null terminator (\0),
but I have not found no commands for this function. Could be this my problem?
Excuse me but I am a little new to the program NSIS.
Tanks you for the time that yoy dedicate to me, best regards


Well, those are not string pointers and you must therefore append their size to `&t`.

System::Call *(&t52, &t36 ...)