FFI & C++ & Cygwin

Sven Panne Sven.Panne@informatik.uni-muenchen.de
Sun, 12 Jan 2003 00:06:00 +0100


Just a very general remark on this topic:

Mixing C and C++ is a highly delicate undertaking, see e.g. item 34 in
Scott Meyer's highly recommendable "More Effective C++". The linking
errors you see are probably related to initialization/shutdown of the
C++ runtime system, including construction and destruction of C++
statics. Even if you don't use the latter, a library you use could do.

As a rule of thumb, if any part of your program is written in C++,
compile "main" with the same C++ compiler and link the same way as
your C++ compiler does. Otherwise there can be *very* strange effects
like non-working "catch" clauses, segfaults in C++'s runtime system,
flawed template instantiations, etc. (War stories available if
requested :-}

Cheers
    S.