[fpc-pascal] DLL call works on FPC 2.6.4 but not with D7
Paul Breneman
Paul2006 at BrenemanLabs.com
Tue Jul 1 16:59:03 CEST 2014
Below is code from a C program (that works).
From the ".h" files:
typedef uint32_t PICO_INFO;
typedef uint32_t PICO_STATUS;
PREF0 PREF1 PICO_STATUS PREF2 PREF3 (ps5000aGetUnitInfo)
(
int16_t handle,
int8_t * string,
int16_t stringLength,
int16_t *requiredSize,
PICO_INFO info
);
From a ".c" program:
int16_t i = 0;
int16_t requiredSize = 0;
int8_t line [10];
PICO_STATUS status = PICO_OK;
status = ps5000aGetUnitInfo(unit->handle, line, sizeof (line),
&requiredSize, i);
**************
Here is the dll call I'm having trouble with:
function ps5000aGetUnitInfo
(handle : smallInt;
var str : Pchar;
stringLength : smallInt;
var requiredSize : smallInt;
info : integer
) : integer;
{$IFDEF WIN32} stdcall; external 'ps5000a.dll';{$ENDIF}
I have two console programs that are almost identical.
Here is my FPC 2.6.4 call (that works):
Status := ps5000aGetUnitInfo( ps5000a_handle, MyReturnStr,
StringLen, requiredSize, RInfo);
Here is my D7 call (that doesn't work):
Status := ps5000aGetUnitInfo( ps5000a_handle, @MyReturnStr,
StringLen, requiredSize, RInfo);
In D7 I have to add "@" on "MyReturnStr or the program crashes. With
the "@" added the program doesn't crash, but things still don't work.
Any suggestions on what to look at?
More information about the fpc-pascal
mailing list