Two more FFI bugs (maybe they have the same reason).  If I
put

  module Main
  where

  import Addr (Addr)

  foreign export ccall dynamic mk :: (Addr -> IO ()) -> IO Addr

  foo :: Addr -> IO ()
  foo _ = print "bla\n"


  main = do
           fooHdl <- mk foo
           return ()

into a file whose name is *not* `Main.hs', but for example
`ffi-bug.hs', I get

  ffi-bug3_stub.c:3: Main_stub.h: No such file or directory

(because the stub file explicitly references a header file
that is named after the module name, but actually generated
with the name of the source file).  

Furthermore, if I put the same code in a file `Main.hs' (to
avoid the above bug), then, during linking, I get

 Main.o(.text+0xd9): undefined reference to `d1qQ'

because the file `Main_stub.o' (which included the function
definition for `d1qQ') isn't included in the linking
process.  If I add this file explicitly to the list of
object files on the command line, everything works fine.

Manuel

Reply via email to