This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mixing libstdc++.6 and libstdc++.5 in the same application


Magnus SjÃgren <magnus.sjogren@comsol.se> writes:

> I am developing an application in C++ with a GCC version that uses
> libstdc++.6 and wants to link to a dynamic library which has a pure C
> API, but internally uses C++ and depends on libstdc++.5.
> 
> Are there any problems doing this?

You didn't say what system you are using.  I'm going to assume
GNU/Linux or some other ELF system.

Yes, there are problems.  It mostly works, and it may work in your
case.  But there are some cases where the same symbol name is used in
both libstdc++.so.5 and libstdc++.so.6, and the dynamic linker will
let one library override the other in using that symbol name.  If
those symbols are used by your program, you will have trouble.

There are some relatively baroque ways to get around this.  For
example, you can use the linker's -F/--filter option to create a new
dynamic library which defines only the symbols exported by the C API.
That should hide the libstdc++.so.5 symbols from the dynamic linker,
and prevent the overriding confusion.  But I haven't actually tried
this, and I can't promise that it will work.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]