From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,c04e7bb2fc34b078 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-23 09:14:39 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Win32 binding Date: 23 Apr 2002 12:06:07 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: skates.gsfc.nasa.gov 1019578338 6162 128.183.220.71 (23 Apr 2002 16:12:18 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 23 Apr 2002 16:12:18 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:22993 Date: 2002-04-23T16:12:18+00:00 List-Id: "Antonio L�pez" writes: > I am using the Win32 binding that comes with the Gnat compiler in order to > interface with the API of a Dll. > > When searching for an use example of "type ULONG_Array is array (Natural > range <>) of aliased ULONG;", I found only one in win32-rpcndr.ads. > However instead of declare an array, it declares the elements alone, calling > for "storage unit bounday". the keyword "aliased" in the definition of ULONG_Array means that the compiler must be able to provide pointers to the elements of the array. In practice this means they elements must be directly addressable, which means they must start on storage unit boundaries. "storage unit boundaries" is the precise term for the common notion of "byte" or "memory location". For example, if the elements of the array were 4 bits, you could pack two into a single byte; then the elements would _not_ be directly addressable, so the keyword "aliased" forbids this packing. However, in this particular case, the elements are 32 bit integers, and there is no reason not to align them on byte boundaries, so I don't think the comment in win32-rpcndr.ads is meaningful. Hmm, it might have some impact on a machine that had 16 or 32 bit storage units, but I'm not aware of Windows ports to any such machines! > I have searched for "storage unit bounday", but I don0t understant > the concept and/or the problem. Can some enlight me, please? > > Cheers, > Antonio > > > -- Reserved : Win32.ULONG_Array(0..6); -- rpcndr.h:802 > -- @@ with GNAT the type ULONG_Array must be aligned at a storage > -- unit boundary. So I decided for now to declare Reserved<1..7> > -- instead. > Reserved1 : Win32.ULONG; > Reserved2 : Win32.ULONG; > Reserved3 : Win32.ULONG; > Reserved4 : Win32.ULONG; > Reserved5 : Win32.ULONG; > Reserved6 : Win32.ULONG; > Reserved7 : Win32.ULONG; > end record; > > > -- -- Stephe