
I'm trying to use from Haskell a C++ library (Omega Calculator). I'm using the following command: ghc -c -fglasgow-exts -package lang main.hs ghc main.o mylib.o -lomega -lstdc++ -fglasgow-exts -package lang Do I need to add more options? The compilation went fine (after I added -lstdc++ which is invoked by default by "g++", but not by "ghc"), but the executable generates a core. Omega library used from a C++ file, with the same call, and same parameters runs ok. Best regards, Corneliu

G'day all. On Sat, Jul 21, 2001 at 01:32:43AM +0800, Corneliu Popeea wrote:
I'm trying to use from Haskell a C++ library (Omega Calculator). I'm using the following command:
ghc -c -fglasgow-exts -package lang main.hs ghc main.o mylib.o -lomega -lstdc++ -fglasgow-exts -package lang
Do I need to add more options?
To reliably link with C++, you need to compile both the code which invokes C++ (i.e. whatever uses the C++ library) and "main" (that is, ghc/rts/Main.c, not main.hs) with a C++ compiler. So, in summary: - Compile any code which may call the C++ library (and keep inter-module inlining in mind; probably safest to compile all of your code this way) via C, and compile the C with g++. - Re-compile the run-time system (at least Main.c) with g++, too. That may not fix your specific core dump, but you'll need to do this anyway. Cheers, Andrew Bromage
participants (2)
-
Andrew J Bromage
-
Corneliu Popeea