logo       

RE: bug with -O -ffi and multiple module: msg#00069

lang.haskell.glasgow.bugs

Subject: RE: bug with -O -ffi and multiple module

> 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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise