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?
_______________________________________________
fpc-pascal maillist  -  [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to