bug with -O -ffi and multiple module
Simon Marlow
simonmar at microsoft.com
Wed Jan 29 06:15:50 EST 2003
> Okay, here's a weird one. There's something wrong with the
> ffi when using
> -O and the foreign imports are from another module. For example, our
> foreign module, foo.c contains functions:
>
> void* openFile(char*fn);
> void closeFile(void*f);
> float readFloat(void*f);
>
> which are interfaced from foo.h. We have a FooIntr.hs interface file,
> which looks like:
>
> foreign import ccall "foo.h openFile" c__openFile :: Ptr
> CChar -> IO
> (Ptr ())
> foreign import ccall "foo.h closeFile" c__closeFile :: Ptr
> () -> IO ()
> foreign import ccall "foo.h readFloat" c__readFloat :: Ptr () -> IO
> CFloat
I think what you're seeing here is an instance of this bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=655400&group_id
=8032&atid=108032
Workaround: use -#include instead of including the header file in the
FFI spec.
Cheers,
Simon
More information about the Glasgow-haskell-bugs
mailing list