tis 2002-09-10 klockan 16.39 skrev Simon Marlow:
tis 2002-09-10 klockan 16.08 skrev Martin Norbäck:
Now I have done the following:
# ghc -fglasgow-exts -c Adder.hs # gcc -c -DDLL_IMPORT= -I/usr/lib/ghc-5.04/include dllMain.c # ld -shared -o adder.so Adder.o Adder_stub.o dllMain.o -L/usr/lib/ghc-5.04 -lHSbase -lHSbase_cbits -lHSrts -lHSbase -lgmp # gcc test.c -L. -ladder # env LD_LIBRARY_PATH=. ./a.out
and then I get the following:
a.out: fatal error: LOOKS_LIKE_GHC_INFO- is incorrectly defined
What to do next, I wonder...
Here are the files used so you can test for yourself. Oh, and adder.so above should be libadder.so.
You can't make a dynamic library containing Haskell code on Unix, sorry. What actually is it you're trying to do?
I want to make a library that can be used to link against from C code. This library contains Haskell code, and I've made some C code to interface with the Haskell code, using startupHaskell and shutDownHaskell. I want to make a self-contained library (which will contain the Haskell run-time code, the Haskell code, and the C interface code) that I can link to without having to use ghc to link. I also would like to make this library dynamic so that I can dlopen it later. When I link the .o files with to produce an executable (with gcc) everything works fine. I get a binary that does what it should. I don't see the reason why I shouldn't be able to link dynamically against the same .o files when they are in a dynamic library. And whatever the reason is, how much work do you think it will take to fix it? And how easy is it? Regards, Martin -- Martin Norbäck d95mback@dtek.chalmers.se Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG http://www.dtek.chalmers.se/~d95mback/ SWEDEN OpenPGP ID: 3FA8580B