Hi!
I m trying to verify an equipment status in a emulator program using a DLL.
PB -> DLL -> read the emulator equipament status
Using the emulator program works well.
In Powerbuilder 2019 R2 - BUILD 2353
- in Global External Functions:
function string ConsultarSAT ( long al_nrSession ) Library "SAT.DLL"
- Calling the function:
string ls_status
ls_status = consultarSAT( 123456 )
I pass a number of 6 digits and return a string.
But, when i execute occurred the error:
Specified argument type differs from from required argument type at runtime in DLL function consultarsat.
(Invalid stack pointer on return from function call) at line ...
I tried many different arguments variables, but i didn't solve this
The sat.dll follow attached
I appreciate some help.
Thanks!
Eduardo
1. The SAT.DLL uses the cdecl calling convention, according to the Delphi declaration you provided. Refer to the section named "Calling Conventions" in the following URL:
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Procedures_and_Functions_(Delphi)
Delphi can apparently use different calling conventions. PB can only use the stdcall calling convention.
2. The return string from the DLL function is UTF8-encoded. PB strings are UTF16LE-encoded, but external functions can also handle ANSI-encoded strings via the ALIAS FOR "entrypointname;ansi" directive in the external function declaration./
It may or may not be possible to interface with this DLL from C#, then into PB from a .NET assembly (not my area of expertise)... if so, others in the community may be able to advise you further.