GreenCard (How to Marshell Int64)
Liwen Huang
liwen.huang at yale.edu
Thu Dec 11 20:55:25 EST 2003
Hello:
I am using GreenCard to import some C code into Haskell. The code I want to import uses "long" in a lot of places. I tried to write my own DIS for it and I also write a very simple test program. However, the DIS does not work properly. My program and test result are as following:
--------------------------------------------------------------------------
module TLong where
import Foreign.GreenCard
type Long = Int64
%dis long x = int64 x
%dis int64 x = %%Int64 ({HsInt64} x)
%fun tslong :: Long -> Long
%call (long a1)
%code long a2;
% a2 = a1;
% printf("the long integer is %d the original is %d \n", a2, a1);
%result (long (a2))
------------------------------------------------------------------------------
.....
TLong>tslong 1
the long integer is -1073752653 the original is -10173752653
-4611732526480752641
------------------------------------------------------------------------------
I know it is caused by my DIS, but I have no idea what is the right way to do it. Does anyone know the right way to do it?
Best Regards
Liwen-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://haskell.org/pipermail/haskell/attachments/20031211/0c77a994/attachment.htm
More information about the Haskell
mailing list