Not sure, but I would try something like

FS.ReadBuffer(fsbuffer[0],recordsize);

The function is declared as 
  ReadBuffer(var Buffer; ....


So in reality a pointer to the variable is passed to the function. Your 
dyn-array is already a pointer. You are passing in a pointer to the internal 
pointer, and not to the bytes you allocated.

Martin



Dave Coventry wrote:
> I have a function that I'm trying to pass an array to.
>
> function FieldValueAsString(fsbuffer: array of Byte; fitype,fisize:
> integer): string;
>
> Calling the function:
>
> setlength(fsbuffer,recordsize);
> FS:=TFileStream.Create(fname, fmshareDenyWrite);
> FS.Seek(seekpos,soFromBeginning);
> FS.ReadBuffer(fsbuffer,recordsize);
> dfstring:= FieldValueAsString(fsbuffer,fitype,fisize);
>
> Generates the error "Project raised exception class SIGSEGV"
> _______________________________________________
> Lazarus mailing list
> [email protected]
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>   
_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to