On 01/07/14 17:27, Paul Breneman wrote:
Sorry, but after I sent the email above I realized that I was editing a
file in the wrong folder.  Free Pascal doesn't work with "var" on the
line below:
   var str : Pchar;

This is what works on FPC 2.6.4:
function ps5000aGetUnitInfo
          (handle : smallInt;
           Str : Pchar;
           stringLength : smallInt;
           var requiredSize : smallInt;
           info : integer
           ) : integer;
{$IFDEF WIN32} stdcall; external 'ps5000a.dll';{$ENDIF}

It will work in both FPC and Delphi if you pass @MyReturnStr[1], provided that the length of MyReturnStr is sufficiently large. When dealing with addresses to strings/arrays, always explicitly specify the first element you want to use rather than the entire string/array. That will always work regardless of the string or array type (static/dynamic/open/... array, ansi/short/wide/..., and even pchar).


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to