Page 1 of 1

Compiling in Lazarus on Win64

Posted: 12.04.2007, 06:26
by urusai
I'm trying to get ZeosLib compiled under Lazarus in Win64, and I've come across two problems so far:

1) In ZClasses, line 258 (TZAbstractObject.Hash), casting Self to LongInt fails. My solution:
Result := LongInt(@Self);
...which is presumably the desired result. I recommend this be patched ( assume @Self = address of Self vs. @Self being a pointer to the stack...I'm rusty on this).

2) In ZCollections, there is assembly on line 273 (TZCollection.Error, ReturnAddr function). The return address is being copied from the stack. This doesn't compile, obviously. I'm not familiar with AMD64 assembly, and I know that the AMD64 call frame is different, so I have no solution. I need the equivalent to:
asm
MOV EAX,[EBP+4]
end;
in AMD64 (EBP+4 being the location of the return address, presumably). I also don't know what $DEFINE exists for the conditional compilation, presumably WIN64 vs. WIN32.

EDIT: Changed to

[font=Courier New] function ReturnAddr: Pointer;
asm
{$IFDEF WIN64}
MOVQ 32(%RBP),%RAX
{$ELSE}
MOV EAX,[EBP+4]
{$ENDIF}
end; [/font]

Compilation proceeds. Now I see, once again, integer casts of objects. The offending code:
Result := Integer(Fields);
where Result = TIntegerDynArray and Fields = TFields.
Nice. How about a TPointerDynArray? I realize that in theory "integer" = machine word size = pointer size, but real life intercedes.

Posted: 23.01.2008, 17:50
by nyrell
Hi, I am experiencing the same problems when trying to compile ZeosLib för AMD64 under kubuntu 7.10.

I'm using the following:
Lazarus 0.9.24
FPC 2.2.0 [2007/09/10] for x86_64
ZeosLib v6.6.2-rc


Did you solve the third error? How?

I'm talking about the line

"Result := Integer(Fields);"

in function CreateFieldsLookupTable(Fields: TFields): TIntegerDynArray;
in ZDatasetUtils.pas