
What is the O/S and compiler? That the C++ new operator is not found is very strange. Throw is another story, as throw doesn't appear in the compiled code with some compilers. On Wed, 2002-10-30 at 04:18, Simon Marlow wrote:
I am currently trying to create a Haskell interface to a C++ library and cannot get it to work completely. The problem seems to be that the linker must be able to find the code for basic C++ constructs like new and throw. Apparently it is able to do so when compiling an executable, but when I try to do the same with ghci it fails. Anybody have an idea why this happens and what to do about it?
I don't know the gory details, but it might be that we would have to link GHCi with the C++ linker for this to work. Would anyone with a clue about C++ linking like to comment?
The feature to install local packages is currently a bit awkward. I would like to be able to simply use a local package the same way I use a normal package, and my first try was to set the package-conf file in my .ghci file. But this doesn't work very well for two reasons: (1) it only works for the interpreter, but not for the compiler (2) it isn't read until *after* the command line is read, so any packages given there is not recognized. Is it possible to have a common (.ghc) file that is used for both the compiler and the interpreter, and that is read *before* the command line is interpreted?
Hmm, I must admit I'm a bit averse to adding features like this unless they are really necessary. One problem is that when someone submits a bug report, we'll have to start asking "do you have a .ghc file? what does it contain?". The current situation has the advantage of being simple.
Can't you just alias ghc to 'ghc -package-conf ...'?
Cheers, Simon _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users -- Seth Kurtzberg M. I. S. Corp 480-661-1849 Pager 888-605-9296, or 6059296@skytel.com

On 30 Oct 2002, Seth Kurtzberg wrote:
What is the O/S and compiler? That the C++ new operator is not found is very strange. Throw is another story, as throw doesn't appear in the compiled code with some compilers.
We run Solaris + gcc 2.95.3. The exact error message looks like this: Prelude> :set -package satnik Loading package satnik ... linking ... /.../chalmers.se/fs/cab/cs/work/proj/formal-methods/home/src/fm/HSatnik/Satnik.o: unknown symbol `__builtin_new' ghc-5.04.1: panic! (the `impossible' happened, GHC version 5.04.1): can't load package `satnik' Please report it as a compiler bug to glasgow-haskell-bugs@haskell.org, or http://sourceforge.net/projects/ghc/. ... which to me seems like it cannot find new. /Niklas

Many platforms have the C++ runtime and the C++ standard library as a static library (probably because the C++ ABI is not as stable as it should be...). I think this applies to both Mac OS and to Windows [mingw32], perhaps it's the same with Solaris. If that is the case, it would explain the problem, I think. GHCi can't load static libraries [yet - the ar format shouldn't be too difficult to implement], so everything that's needed from static libraries has to be linked into the ghc binary and probably also listed in Linker.c (who else doesn't like those hard-coded symbol references?) Just my EUR 0.02 :-) Cheers, Wolfgang

Wolfgang, On Solaris, you can build GNU C++ either way; that is, to use shared libraries or linked libraries. (In fact you can also build it to enable both, and select one or the other at link time.) So, this is certainly worth checking. The easiest way to check it is to run "ldd -r" on the executable. On Wed, 2002-10-30 at 15:53, Wolfgang Thaller wrote:
Many platforms have the C++ runtime and the C++ standard library as a static library (probably because the C++ ABI is not as stable as it should be...). I think this applies to both Mac OS and to Windows [mingw32], perhaps it's the same with Solaris. If that is the case, it would explain the problem, I think.
GHCi can't load static libraries [yet - the ar format shouldn't be too difficult to implement], so everything that's needed from static libraries has to be linked into the ghc binary and probably also listed in Linker.c (who else doesn't like those hard-coded symbol references?)
Just my EUR 0.02 :-)
Cheers, Wolfgang
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users -- Seth Kurtzberg M. I. S. Corp 480-661-1849 Pager 888-605-9296, or 6059296@skytel.com
participants (3)
-
Niklas Sörensson
-
Seth Kurtzberg
-
Wolfgang Thaller