Re: [Haskell-cafe] GHCi fails to load C++ object files (missing symbol)

2012-03-08 Thread Mark Wright
Hi Yves, It works (on Gentoo) when I compile it as a shared library. % g++ -o libstuff.so -fpic -shared Stuff.cpp % ghci Main.hs -L$PWD -lstuff GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp

Re: [Haskell-cafe] GHCi fails to load C++ object files (missing symbol)

2012-03-08 Thread Yves Parès
Thanks Mark! It works also here, and even without the -fpic flag. Was it necessary for you? 2012/3/8 Mark Wright markwri...@internode.on.net Hi Yves, It works (on Gentoo) when I compile it as a shared library. % g++ -o libstuff.so -fpic -shared Stuff.cpp % ghci Main.hs -L$PWD -lstuff

Re: [Haskell-cafe] GHCi fails to load C++ object files (missing symbol)

2012-03-08 Thread Mark Wright
On Thu, 8 Mar 2012 12:55:51 +0100, Yves Parès yves.pa...@gmail.com wrote: Thanks Mark! It works also here, and even without the -fpic flag. Was it necessary for you? Hi Yves, Yes it is necessary for me to use -fpic when building C/C++ shared libraries as: - I'm on amd64 - Its a Gentoo

Re: [Haskell-cafe] GHCi fails to load C++ object files (missing symbol)

2012-03-08 Thread Hans Aberg
On 8 Mar 2012, at 13:21, Mark Wright wrote: It might work without -fpic on x86 (32 bit): http://www.mail-archive.com/gentoo-dev@gentoo.org/msg01420.html On OS X, it is always on; I tried the example on 10.7, Xcode 4.3. I had to add ln -s /Applications/Xcode.app/Contents/Developer

[Haskell-cafe] GHCi fails to load C++ object files (missing symbol)

2012-03-07 Thread Yves Parès
Hi, I'm trying to have GHCi load a haskell file that depends on a C++ object file, which causes GHCi to fail because of an unknown symbol (*and I did link with **libstdc++*), whereas the link into an executable with ghc works and runs perfectly. I've reduced my code to the smallest one that

Re: [Haskell-cafe] GHCi fails to load C++ object files (missing symbol)

2012-03-07 Thread Yves Parès
Sorry for the double post, but I forgot to mention I'm using GHC 7.4 and gcc/libstdc++ 4.5.2. (Running Ubuntu 11.04 Natty Narwhal). 2012/3/7 Yves Parès yves.pa...@gmail.com Hi, I'm trying to have GHCi load a haskell file that depends on a C++ object file, which causes GHCi to fail because of