C call stack compromised

Posted by Admin on 09-Feb-2009 10:49

Hi all,

I'm facing a problem (6069, C call stack compromised) when trying to call functions in an external product DLL, followed by a progress session crash.

Function signature is : L_INT L_VersionInfo(pVersionInfo, uStructSize)

where pVersionInfo is a pointer to a structure, and uStructSize is the size of the structure.

Calling this function in C is OK, I'm declaring a variable, use memset to initialize it, and then call the function.

In 4GL, I'm declaring the function like this :

procedure L_VersionInfo external "xxx.dll" persistent:

define input parameter mStruct as memptr.

define input parameter sz as long.

define return parameter retVal as long.

end procedure.

The code to call the function declares a memptr, do a set-size with the value of sizeof(struct), and call the function. Which leads to the session crash...

I also tried using long parameter and get-pointer-value, without success.

Using CDECL option doesn't help too.

My question is : is there something I'm doing wrong when declaring or calling my function ? Or may it be related to the DLL itself ?

10.2A - Win32

All Replies

Posted by Simon de Kraa on 09-Feb-2009 11:38

Well, I was going to suggest using the CDECL but I see you already tried that...

You probably already looked at the ProKB entries but you are passing correct structure data? See attachment.

Posted by Admin on 09-Feb-2009 13:21

The function needs memory to be allocated and filled with 0 (using memset in C or put-byte loop in 4GL), so I guess the problem doesn't come from here.

BTW, thanks for this KB entry, I didn't find this one during my search.

Posted by Admin on 10-Feb-2009 14:21

Got it! The machine I was working on had header files not in sync (version n+1) with the DLL. What's weird is that the function isn't defined the correct header, but is obviously exported in the DLL...

This thread is closed