
Hi, 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? A second question, 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? /Niklas

Hi, I am currently trying to create a Haskell interface to a C++ library and cannot get it to work completely.
If you want to interface Hugs to C++ code, you have to link Hugs using a C++ compiler so that the Hugs binary contains new, throw, etc. I believe the main thing this changes is that some extra libraries are linked into the binary. Obviously, the story is a bit different for GHC but you probably want to either: 1) Tell GHC to use a C++ compiler as its linker; or 2) Figure out what libraries C++ adds in (e.g., compare what g++ -v and gcc -v do with hello world) and tell GHC to use them when linking. -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/
participants (2)
-
Alastair Reid
-
Niklas Sörensson