Page 1 of 1

function pointer in lss

PostPosted: Mon Apr 05, 2010 3:14 am
by throw
Hello,

Is it possible to have function pointers in an LSS script ?
I am trying to compile this, but am getting a syntax error:

Code: Select all
int    (*Dll_GetTimestamp)(void);



I am trying to load a dll and call some functions in the dll that will return values to LSS script.

Many thanks.

Re: function pointer in lss

PostPosted: Mon Apr 05, 2010 12:51 pm
by L. Spiro
Refer to the CallLocalFunction() function in the help file.


L. Spiro

Re: function pointer in lss

PostPosted: Tue Apr 06, 2010 6:52 pm
by throw
Hello L. Spiro thanks for that.

It is working with a dll function that returns an int.

Is there a description of the LOCAL_CALL_RETURN structure anywhere? I wonder if I can allocate memory in LSS and pass a pointer to the memory, to a dll function for it to write to...

Re: function pointer in lss

PostPosted: Wed Apr 07, 2010 8:16 am
by L. Spiro
It is not in the help file because it is a typedef of REMOTE_CALL_RETURN.


Code: Select all
union REMOTE_CALL_RETURN {
    unsigned char bByte;                                        // Offset: 0, Size: 1.
    char cChar;                                                 // Offset: 0, Size: 1.
    unsigned short wWord;                                       // Offset: 0, Size: 2.
    short sShort;                                               // Offset: 0, Size: 2.
    unsigned int dwDWord;                                       // Offset: 0, Size: 4.
    int lLong;                                                  // Offset: 0, Size: 4.
    unsigned __int64 ui64Int64;                                 // Offset: 0, Size: 8.
    __int64 i64Int64;                                           // Offset: 0, Size: 8.
    float fFloat;                                               // Offset: 0, Size: 4.
    double dDouble;                                             // Offset: 0, Size: 8.
    unsigned int uiPtr;                                         // Offset: 0, Size: 4.
}; // Size: 8.




L. Spiro

Re: function pointer in lss

PostPosted: Wed Apr 07, 2010 10:26 pm
by throw
Thanks L.Spiro good work :)

In CallLocalFunction() I had to pass the dll functions parameters in reverse order.