FFI & C++ & Cygwin

Koen Claessen koen@cs.chalmers.se
Fri, 10 Jan 2003 14:11:35 +0100 (MET)

Dear GHC users,

I have the following problem and I wonder if anyone can

I am using the FFI to talk to a library of functions
written in C++.

On Unixes (Solaris, Linux) this works just fine if one adds
the right -ldstdc++ here and there.

However, I am using Cygwin now and that is where all the
problems start.

The C++ stuff compiles fine (using Cygwin's g++). The
Haskell stuff compiles just fine (using Win Ghc). However,
at linking time I get the following error:

  - undefined reference to '_impure_ptr'
  - undefined reference to 'operator delete(void*)'
  - undefined reference to 'vtable for ___cxxabiv1::__blahblah'

These are all things that C++ uses internally.

I think the problem is that I used Cygwin's g++ compiler and
that Ghc uses Mingwin's gcc compiler to compile and link.

However, I have tried to recompile the C++ libraries using
the Mingwin C++ compiler but it starts throwing pages of
error messages at me.

The other way around: using a Cygwin specific GHC, seems
more appropriate, but where does one get one of those? (I
have never managed to compile one myself.)

Any ideas?