Hugs ffi, sizeOf operator

R. Legere legere@adelpia.net
Mon, 6 Jan 2003 15:42:27 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_002D_01C2B59A.370C9E00
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I ran into a possible problem while testing some ffi code.
 This is with hugs compiled for cygwin or with the windows (msi)  =
version.
Hugs says: sizeOf x::CDouble is 4,
wheras 'C' says sizeof(double) is 8.

I ~~think~~ I see what the problem is with sizeOf.  I am using the
new hierarchical libs, and it defines sizeOf by hardcoding the sizes =
rather
then asking 'c' like the previous versions did. And sizeOf Double is =
coded
as 4 in libraries\Foreign\Storable.hs
Is there something simple I just don't understand?=20

As a side note, is alignPtr implemented somewhere?

(Alastair, I already sent this to you, but didnt sent to the list.)

Gratefully,=20
  Ron
------=_NextPart_000_002D_01C2B59A.370C9E00
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>I ran into a=20
possible problem while testing some ffi code.<BR>&nbsp;This is with hugs =

compiled for cygwin or with the windows (msi)&nbsp; version.<BR>Hugs =
says:=20
sizeOf x::CDouble is 4,<BR>wheras 'C' says sizeof(double) is=20
8.<BR></FONT></FONT><FONT face=3DArial size=3D2><FONT face=3D"Times New =
Roman"=20
size=3D3><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3><BR>I=20
~~think~~ I see what the problem&nbsp;is with&nbsp;sizeOf.&nbsp; I am =
using=20
the<BR>new hierarchical libs, and it defines sizeOf by hardcoding the =
sizes=20
rather<BR>then asking 'c' like the previous versions did. And sizeOf =
Double is=20
coded<BR>as 4 in =
libraries\Foreign\Storable.hs</FONT></FONT></FONT></FONT><FONT=20
face=3DArial size=3D2><FONT face=3D"Times New Roman" size=3D3><FONT =
face=3DArial=20
size=3D2></FONT><BR>Is there something simple I just don't understand?=20
</FONT></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>As a side note, is alignPtr implemented =

somewhere?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV>
<DIV>(Alastair, I already sent this to you, but didnt sent to the =
list.)</DIV>
<DIV><BR>Gratefully, </DIV>
<DIV>&nbsp; Ron</FONT></DIV></BODY></HTML>

------=_NextPart_000_002D_01C2B59A.370C9E00--