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

Fredrik Orderud forderud@gmail.com
Fri Nov 14 18:57:22 GMT 2025


> > 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?


More information about the Libstdc++ mailing list