Hallo, I try to use a Function calc, which is written in C (CalcType = Int): foreign import ccall calc :: CInt -> CInt -> CInt calculate :: Int -> Int -> CalcType calculate a b | ... | ... | otherwise = calc a b Unfortunately I got an error. What shall I do? best regards Daniel -- NEU: Bis zu 10 GB Speicher f�r e-mails & Dateien! 1 GB bereits bei GMX FreeMail http://www.gmx.net/de/go/mail
"Daniel Müller" <danielmu@gmx.de> writes:
foreign import ccall calc :: CInt -> CInt -> CInt
calculate :: Int -> Int -> CalcType calculate a b | ... | ... | otherwise = calc a b
Unfortunately I got an error. What shall I do?
Use fromIntegral to convert between CInt and Int, and something for CalcType depending on what it is. (It would help if you told *what* error, but I guessed.) -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/
On Monday 06 September 2004 14:10, "Daniel Müller" wrote:
I try to use a Function calc, which is written in C (CalcType = Int): [...] Unfortunately I got an error. What shall I do?
Telling us what the error is (cut and paste from the terminal is best) would be a start. If the program compiles but gives an unexpected answer, say what answer you get and what you expect. What compiler and version are you using? Providing a _complete_ example we can try ourselves would be another thing to try. -- Alastair Reid
participants (3)
-
"Daniel Müller" -
Alastair Reid -
Marcin 'Qrczak' Kowalczyk