[fpc-pascal] porting to 64bit

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Jun 24 17:09:52 CEST 2011

On Fri, 24 Jun 2011 16:56:09 +0200
fred f <ffred69 at gmail.com> wrote:

> Hi,
> What's wrong on this condition to get the code running on 32 and 64bit:
> // Get pointer to varlength data.
> function GetVarLengthData(AVarLength:PAnsiChar):PAnsiChar;
> begin
>      Result:=PAnsiChar(AVarLength){$IFDEF FPC}+SizeOf(PtrInt){$ELSE}+4{$ENDIF};

I wonder why you cast a PAnsiChar to a PAnsiChar?

Without any further code your "AVarLength" can be anything.
Probably it is something like a Size plus Data.
Check your GetVarLengthSize function or whatever it is called in your
code for the size of the Size.

> end;


More information about the fpc-pascal mailing list