64 bits Compatibility

Code samples and contributions from users for ZeosLib's DBOs of version 6.x

Moderators: gto, cipto_kh, EgonHugeist, mdaems

Post Reply
matthius
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 06.03.2009, 17:53

64 bits Compatibility

Post 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));
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
rayanAyar
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 02.07.2010, 04:26

Re: 64 bits Compatibility

Post by rayanAyar »

matthius wrote:To be 64 bits compatible here is the code :
...
This changes as patch for Zeos 6.6.6
You do not have the required permissions to view the files attached to this post.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
rayanAyar
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 02.07.2010, 04:26

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
rayanAyar
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 02.07.2010, 04:26

Post 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}
marcov
Senior Boarder
Senior Boarder
Posts: 95
Joined: 24.06.2010, 09:17

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
Post Reply