zertovitch / gwindows

GWindows: GUI framework for MS Windows
https://sf.net/projects/gnavi/
21 stars 5 forks source link

HINSTANCE and HKEY are 64-bit on 64-bit platforms #4

Closed Patschkowski closed 3 years ago

zertovitch commented 3 years ago

Just for my understanding, I've written a little program showing the bit sizes involved:

with Ada.Integer_Text_IO, Ada.Text_IO;

with Interfaces.C;

procedure Show_Sizes is
  use Ada.Integer_Text_IO, Ada.Text_IO;
begin
  Put ("Interfaces.C.ptrdiff_t"); Put(Interfaces.C.ptrdiff_t'Size); New_Line;
  Put ("Interfaces.C.long     "); Put(Interfaces.C.long'Size);      New_Line;
end;
Patschkowski commented 3 years ago

HANDLE is a void in Win32, void is different on 32 and 64 bit systems. To avoid casting from integer literals to System.Address I have chosen for ptrdiff_t which is a type large enough to hold pointer offsets, thus following the bit count of pointers on the target.