RE: linking with c++ libraries

| To reliably link with C++, you need to compile both the code | which invokes C++ (i.e. whatever uses the C++ library) and | "main" (that is, ghc/rts/Main.c, not main.hs) with a C++ compiler. | | So, in summary: | | - Compile any code which may call the C++ library (and keep | inter-module inlining in mind; probably safest to compile | all of your code this way) via C, and compile the C with g++. | | - Re-compile the run-time system (at least Main.c) with | g++, too. | | That may not fix your specific core dump, but you'll need to | do this anyway. After some discussion in the GHC office, we're unsure about why you need to compile Main.c with a C++ compiler for this to work. Pls can you clarify? J

G'day all. On Mon, Jul 30, 2001 at 06:06:07AM -0700, Julian Seward (Intl Vendor) wrote:
After some discussion in the GHC office, we're unsure about why you need to compile Main.c with a C++ compiler for this to work.
Under g++ you may not strictly need it. I'm not sure about that. However, some C++ systems do. Such systems handle static constructors and destructors by rewriting the main() function to perform the initialisation and destruction. See also Eric Myers, "More Effective C++" item 34. It's also touched on briefly in the C++ FAQ: http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html Cheers, Andrew Bromage
participants (2)
-
Andrew J Bromage
-
Julian Seward (Intl Vendor)