we have tried long and hard to call Haskell functions from C++ using
the FFI mechanism but without success. 


Don't forget to say which platform you're on - the solution might be slightly platform-dependent.

  $ ghc -fffi Foo.o Foo_stub.o main.cpp 
  main.o(.text+0x22): In function `main':
  main.cpp: undefined reference to `__stginit_Foo()'


#ifdef __GLASGOW_HASKELL__
extern void __stginit_Foo ( void );
#endif

This should be...

extern "C" void __stginit_Foo ( void );


  main.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
  collect2: ld returned 1 exit status

On Mac OS X, all you need to do is add -lstdc++ to your ghc command line; it may or may not be that easy on other platforms.


Cheers,

Wolfgang