[Lazarus] Error when create a main window

Carlos German Tejero german_tejero at yahoo.com.ar
Tue Jan 20 02:28:02 CET 2009


Ok,

But when reading or writing to the buffer you do need to reference the
element in which you want to start writing/reading... In the case that
entire buffer is to be written use [0].

You can't write the buffer itself as it's just a pointer...



On Mon, Jan 19, 2009 at 9:35 AM, Dave Coventry <dgcoventry at gmail.com> wrote:
> Hi Andy, thanks for the response.
>
> The array was declared as
> var fsbuffer: array of Byte;
>
> I tried your suggestion and typed the array as
> Type TByteBuffer=Array of Byte;
>
> then declared the buffer
> var fsbuffer: TByteBuffer;
>
> I also declared the function using 'var' as you suggested
>
> function FieldValueAsString(var fsbuffer: TByteBuffer; fitype,fisize:
> integer): string;
>
> But my app is still falling over at the same point.
>
> 2009/1/19 Andrew Brunner <andrew.t.brunner at gmail.com>:
>> Hi Dave,
>>
>>
>> My first comment would be you must declare the input as a variable.
>> Next, I probably would type the Array out as well before using it.
>>
>> Type TByteBuffer=Array of Byte;
>>
>> function FieldValueAsString(var fsbuffer:TByteBuffer; fitype,fisize:
>> integer): string;
>>
>> Byte arrays should not generate an error.  There may be a memory leak
>> for instances where you pass them in as constant values.  Because the
>> Memory manager would need to free that memory as it is a dynamic
>> array.
>>
>> -Andy
>>
>>
>> On Mon, Jan 19, 2009 at 8:20 AM, Dave Coventry <dgcoventry at gmail.com> 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
>>> Lazarus at lazarus.freepascal.org
>>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>>
>> _______________________________________________
>> Lazarus mailing list
>> Lazarus at lazarus.freepascal.org
>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>



More information about the Lazarus mailing list