
Sorry to ask a C question here, but I could not find an answer on the net. How do I create a library that can be used in ghci? This is the situation: I have a c file coracle.c. I do /tmp$ cc -c -o coracle.o coracle.c /tmp$ ar rc libcoracle.a coracle.o /tmp$ ranlib libcoracle.a and then I the library is linked statically with ghc just fine: /tmp$ ghc -L/tmp -lcoracle --make COracle.hs But if I create a shared library, like this: /tmp$ cc -c -shared -o libcoracle.so coracle.c then ghci does not like the format: /tmp$ ghci -L/tmp -lcoracle COracle.hs GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Loading object (dynamic) coracle ... failed. Dynamic linker error message was: /tmp/libcoracle.so: only ET_DYN and ET_EXEC can be loaded Whilst trying to load: (dynamic) coracle Directories to search are: /tmp ghc-6.8.2: user specified .o/.so/.DLL could not be loaded. In the web I only find bla about which bit in the ELF-header of the library tells you that it is ET_DYN or not. But never how to build such a library. I guess it is too much to hope for a C-freak around here but I am sure a semi-freak or quarter-freak will do as well. Thanks in advance! Bernd