<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1276" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hello:</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; I am using GreenCard to 
import some C code into Haskell. <FONT size=2>The code I want to import uses 
"long" in a lot of places. I tried to write my own DIS for it 
and&nbsp;I&nbsp;also write a very simple test program. However,&nbsp;the DIS 
does not work&nbsp;properly. My program and test result are as following:</FONT>
<DIV><FONT 
size=2>--------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT size=2>module TLong where</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>import Foreign.GreenCard<BR></FONT></DIV>
<DIV><FONT size=2>type Long = Int64<BR>%dis long x = int64 x</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>%dis int64 x&nbsp;&nbsp;&nbsp; = %%Int64 ({HsInt64} 
x)</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>%fun tslong ::&nbsp; Long -&gt; Long<BR>%call (long 
a1)<BR>%code long a2;<BR>%&nbsp;&nbsp;&nbsp;&nbsp; a2 = 
a1;<BR>%&nbsp;&nbsp;&nbsp;&nbsp; printf("the long integer is %d the original is 
%d \n", a2, a1);<BR>%result (long 
(a2))<BR>------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT size=2>.....</FONT></DIV>
<DIV><FONT size=2>TLong&gt;tslong 1</FONT></DIV>
<DIV><FONT size=2>the long integer is -1073752653 the original is 
-10173752653</FONT></DIV>
<DIV><FONT size=2>-4611732526480752641</FONT></DIV>
<DIV><FONT 
size=2>------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I know it is caused 
by my DIS, but&nbsp;I have no idea what is the right way to do it. Does anyone 
know the right way to do it?</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>Best Regards</FONT></DIV>
<DIV><FONT size=2>Liwen</DIV></FONT></FONT></DIV></BODY></HTML>