Page 1 of 1

64 bits Compatibility

Posted: 20.07.2009, 13:51
by matthius
To be 64 bits compatible here is the code :

In ZDbcCache :

TZRowBuffer = packed record
Index: SizeInt;
UpdateType: TZRowUpdateType;
BookmarkFlag: Byte;
Columns: TByteArray;
end;

In ZAbstractRODataset :

Index of TZRowBuffer must be 64 bits compliant
Setting Index forcing the integer to be SizeInt
Like this
.Index := SizeInt ( RowNo );

In ZAbstractRODataset Always :
Another part wich is good like this :
if not (State in [dsCalcFields, dsFilter, dsNewValue]) then
DataEvent(deFieldChange, PtrInt(Field));

Posted: 24.07.2009, 23:47
by mdaems
matthius,

Please,

Can you provide a full patch? I can integrate it and test against the other compilers easily, but just guessing what changes are necessary following guidelines is very inefficient.

Mark

Re: 64 bits Compatibility

Posted: 10.01.2011, 15:32
by rayanAyar
matthius wrote:To be 64 bits compatible here is the code :
...
This changes as patch for Zeos 6.6.6

Posted: 13.01.2011, 22:23
by mdaems
rayanAyar,

Do you know how SizeInt should be defined in Delphi 5? Current version of patch doesn't compile on D5 and 6.6 should remain D5 compatible (as it's the last D5 supporting version)

Mark

Posted: 14.01.2011, 02:12
by rayanAyar
1. I can't check on D5. I have no windows. I work with Lazarus@Linux.

2. I am not author of the patch. I just made changes from first post by matthius. Check it work for me (Ubuntu 10.04 amd64). And made diff-file for convinience.

Posted: 26.01.2011, 22:41
by mdaems
Seems like this SizeInt and PtrInt are FPC datatypes which are equal to LongInt. At least on my 32 bit machine.
W8... checked in my 64 bit vm. There they both refer to Integer (which equals LongInt on 32 bit, isn't it?)
Can you test again by replacing All sizeint by Integer in your version?

I did this in my 32 bit machine and that doesn't seem to break the test suite.
Does it also fix 64 bit problems?

Mark

Posted: 20.02.2011, 09:47
by rayanAyar
On 64 bit:
SizeOf(SizeInt) = SizeOf(Int64) = 8
SizeOf(Longint) = 4

systemh.inc(247):
{$ifdef CPU64}
SizeInt = Int64;
PtrInt = Int64;
...
{$endif CPU64}

{$ifdef CPU32}
SizeInt = Longint;
PtrInt = Longint;
...
{$endif CPU32}

Posted: 25.03.2011, 13:52
by marcov
Yes. In principle that is true.

There are also U variants (SizeUint, ptrUint) for unsigned variants, equal to cardinal and qword on resp 32bit and 64-bit

ptr(u)int should be large enough to contain a pointer. (long or longlong in posix lingo)

size(u)int should be large enough to contain the difference between any two pointers. size_t in POSIX jargon.

Posted: 02.04.2011, 22:29
by mdaems
marcov,

Does this mean the solution I proposed 3 posts above this one is allright?

Or should I add

Code: Select all

%u7b$ifndef FPC%u7d 
SizeInt = Longint; 
PtrInt = Longint; 
%u7b$endif%u7d
to ZCompatibility.pas

Mark