Safe to link to static libstdc++ from shared library?

Jonathan Wakely jwakely@redhat.com
Fri Nov 14 20:39:10 GMT 2025


On Fri, 14 Nov 2025 at 18:57, Fredrik Orderud <forderud@gmail.com> wrote:
>
> > > I might be colored by my Windows background here, but I though that
> > > C++ ABI compatibility isn't a problem as long as our shared library
> > > only uses C++ _internally_, while the API i in pure "C" with no
> > > exceptions escaping. However, I might have been naive here(?)
> >
> > Linux works differently. ELF has a single address space for all
> > symbols. You can play games with RTLD_LOCAL and symbol visibility, but
> > it's not reliable for C++ because there are C++ runtime symbols which
> > really do require that they are globally unique in the program image.
> > Which from a quick glance is the reason for your segfaults.
>
> Thanks' for explaining. Are these limitations documented somewhere i
> the libstdc++ documentation (or elsewhere), so that I can get a better
> picture of what's supported?

Nope, sorry.



More information about the Libstdc++ mailing list