[fpc-pascal]Apple Mac pointer problem

Stephen Downs stephend at e-tempest.co.uk
Thu Sep 23 23:09:16 CEST 2004


-----Original Message-----
From:	Marcel Martin [mailto:mm10 at ellipsa.net]
Sent:	Thu 9/23/2004 9:18 PM
To:	fpc-pascal at lists.freepascal.org
Cc:	
Subject:	Re: [fpc-pascal]Apple Mac pointer problem

Stephen Downs a écrit :
> 
> I am porting a Mac CodeWarrior project to FreePascal and have hit a
> compile problem with a pointer. In my original code I have a structure
> defined along the lines of
> 
> testData = record
>    testIndex :  array [0..12] of integer;
> end;
> 
> testDataPointer = ^testData;
> testDataHandle = ^testDataPointer;
> 
> Within my main code I open a file and try to read it into my structure
> 
> testDataHdl := testDataHandle(NewHandleClear(sizeof(testData)));
> OSError := FSRead(fileRefNum, numberOfBytes, testDataHdl^)
> 
> The FSRead line fails with error: 62: Incompatible type for arg no. 3:
> Got "testDataPointer", expected "Ptr" - the third parameter for FSRead is a
> pointer. I presume this is because FreePascal uses typed pointers. I
> tried replacing testDataHdl^ by Ptr(testDataHdl)^ but that gives a
> similar error - Got "ShortInt", expected "Ptr"
> 
> Does anyone know how I can get around this?

>This is very likely a stupid suggestion but have you tried this
>
>  Ptr(testDataHdl^)

I had tried that and it compiles ok but when it runs, the FSRead statement returns an error -36 which is an I/O error

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3098 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20040923/7efd96fc/attachment.bin>


More information about the fpc-pascal mailing list