[Openmcl-devel] Structure Alignment of Foreign Double Floats
James Bielman
jamesjb at jamesjb.com
Sun Jun 5 08:29:50 PDT 2005
Hi,
(I'm using OpenMCL 0.14.3 on OS X 10.4.1)
I'm trying to write a function to determine the alignment of a foreign
type within a structure (for use in a portable FFI library). I came up
with the following:
(defun foreign-type-alignment (type)
"Return the alignment in bytes of foreign type TYPE."
(/ (ccl::foreign-type-alignment
(ccl::parse-foreign-type type)) 8))
When testing with gcc it seems that doubles are aligned to 4-byte
boundaries in structures, yet OpenMCL returns:
? (foreign-type-alignment 'double)
8
Similar code used in SBCL (both systems are derived from CMUCL?)
agrees with GCC and returns 4.
I created a structure type using the OpenMCL FFI and it seems to align
a double to a 4-byte boundary as expected, apparently ignoring the 8
returned by FOREIGN-TYPE-ALIGNMENT.
So, is what I'm trying to do here completely misguided? Is there
a better way to get this information?
Thanks!
James
More information about the Openmcl-devel
mailing list