Hi, how to reproduce this: # cat foo.c #include <inttypes.h> uint64_t foo(double a) { return a; } # gcc -c -Wall foo.c # ghci foo.o ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.4.1, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base-1.0 ... linking ... done. Loading object (static) foo.o ... done final link ... ghc-6.4.1: foo.o: unknown symbol `__fixunsdfdi' ghc-6.4.1: linking extra libraries/objects failed # gcc --version gcc (GCC) 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8) Quick fix: ghci foo.o -lgcc_s Btw, ghc does not have this problem ('ghc Main foo.o' works). Please check, if this is a bug. If this is not Gentoo specific, please report it upstream. Regards Georg Sauthoff
Hi Georg, I don't think ghci is expected to be able to load up arbitrary .o files produces by gcc. What you should do is to create a ghc or Cabal package which tells ghc which extra libraries need to be loaded. The reason it happens to work with ghc in batch mode is that ghc gets gcc to do the linking ang gcc knows about libgcc_s. GHC packages: http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html Cabal packages (which are basically the same thing but more convenient and more portable between Haskell compilers): http://www.haskell.org/ghc/docs/latest/html/Cabal/index.html You may also want to read a guide on the Haskell FFI and how to link to C code.