Profiling makes FFI Marshalling of Doubles and Int64s fail
Bayley, Alistair
Alistair_Bayley at ldn.invesco.com
Tue Sep 14 03:36:09 EDT 2004
I've built a small test case. When I compile with:
ghc Main.hs test.c -o Main.exe
... the (correct) output from Main.exe is:
123.0
5678901234567890
And when I compile with:
ghc -prof Main.hs test.c -o Main.exe
... the (incorrect) output from Main.exe is:
1.0
986516178
------ Main.hs:
{-# OPTIONS -ffi #-}
module Main where
import Foreign.C
foreign import ccall "myDouble" myDouble :: IO CDouble
foreign import ccall "myInt64" myInt64 :: IO CLLong
main = do
d <- myDouble
putStrLn $ show d
l <- myInt64
putStrLn $ show l
------ test.c:
double myDouble() {
double d = 123.0;
return d;
}
long long myInt64() {
long long x = 5678901234567890;
return x;
}
-----------------------------------------
*****************************************************************
Confidentiality Note: The information contained in this
message, and any attachments, may contain confidential
and/or privileged material. It is intended solely for the
person(s) or entity to which it is addressed. Any review,
retransmission, dissemination, or taking of any action in
reliance upon this information by persons or entities other
than the intended recipient(s) is prohibited. If you received
this in error, please contact the sender and delete the
material from any computer.
*****************************************************************
More information about the Glasgow-haskell-users
mailing list