FFI & C++

Simon Marlow simonmar@microsoft.com
Wed, 30 Oct 2002 11:18:03 -0000


> I am currently trying to create a Haskell interface to a C++=20
> library and
> cannot get it to work completely. The problem seems to be=20
> that the linker
> must be able to find the code for basic C++ constructs like=20
> new and throw.
> Apparently it is able to do so when compiling an executable,=20
> 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=20
> awkward. I would
> like to be able to simply use a local package the same way I=20
> 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=20
> 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=20
> 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