|
From: | Bob Friesenhahn |
Subject: | Re: libtool does not add stdc++ when linking on Linux |
Date: | Thu, 19 Jun 2008 13:40:00 -0500 (CDT) |
On Thu, 19 Jun 2008, Christian Thalinger wrote:
On Thu, 2008-06-19 at 12:48 +0200, Andreas Schwab wrote:Right, but ../../src/vm/libvm.la should depend on it, as it does on OpenSolaris, since it contains a C++ object file.Why does that follow? Just because an object is compiled with the C++ compiler does not mean that it uses any features from libstdc++.You are actually right, it does not use any libstdc++ features explicitly, but:
In my experience, the only portable way to deal with C++ dependencies from a C program is to link the C program using the C++ compiler.
Besides the library dependency issues, the C++ code may require different runtime support such as different/extra initialization to support RTTI and C++ exceptions. Without the extra initialization, bad things may happen if a C++ exception is thrown. For example, the program may crash rather than the exception being properly caught by an exception handler or even invoking the standard unhandled exception terminal function. C++ exceptions are now an inherent part of the language.
If the C++ code uses any templates, the C++ linker may be necessary to make sense of them, particularly if template instantiations are stored in a repository.
Bob ====================================== Bob Friesenhahn address@hidden, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
[Prev in Thread] | Current Thread | [Next in Thread] |