Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-06

porting to 64bit

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

fred f

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};
end;

Thanks in advance.

F.

Mattias Gaertner
to fred f
Show quoted text 8 lines
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;

Mattias