-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider symbol visibility for shared library #41
Comments
Thank you, @dkg It was designed as a private static library. Now it needs some reasonable public API |
i don't think the symbol cleanup was as effective as intended here. the only exported symbol removed from the library between 0.8.5 and 0.8.7 was That is, it's good that this symbol was removed, but there are still many other symbols of dubious value to a clean API exposed (at least when building with gcc and the toolchain available in debian testing/unstable). |
@dkg Thanks for checking this.
|
C++ standard library is a template library to the great extent. Template function (or class) is essentially code generator and If I look at the questioned symbols:
Simply speaking, the when a library exports classes/functions that use C++ standard library template types as bases/parameters it also exports all member functions for instatiated templates and their underlying templates recursively as weak symbols. It is is very different from managing export symbols for C-style libraries. If you know how to apply a different method of linkage to C++ standart library please advise. |
@maxirmx, i think you probably have a better understanding of it than i do, unfortunately. You describe some aspects of the problem in ways that make me think more deeply about it, at least ☺ That said, i don't understand how or when C++ applications are supposed to use these library interfaces. For example, consider two libraries that take the same approach, which will both have weak symbols for the templated classes. how does an application decide which one of them to use? What happens if the memory image of the object imagined by one implementation disagrees with the memory image from another implementation? If the answer is that an application won't use either of them, and instead relies on its own instantiation, then why do the libraries need to export the functions in the first place? Anyway, i'm happy to leave this open as a question in the hopes that someone else will come along and offer more insight. thanks for considering it! |
The current shared object produced with
BUILD_SHARED_LIBS=on
exposes many different C++ symbols, and appears to make no attempt to filter what is explicitly exposed.Does every symbol need to be exposed in the shared object? I'm not enough of a C++ person to be able to tell what the library's symbol table should really look like, but i do observe that there are symbols exposed that are not part of either the
sexp
namespace or theext_key_format
namespace.For example, when i try to build it i see the following symbols:
_ZNKSt5ctypeIcE8do_widenEc
(unmangled:std::ctype<char>::do_widen(char) const
)_ZNSt15_Sp_counted_ptrIDnLN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv
(unmangled:std::_Sp_counted_ptr<decltype(nullptr), (__gnu_cxx::_Lock_policy)2>::_M_dispose()
)_ZZNSt8__detail18__to_chars_10_implIjEEvPcjT_E8__digits
(unmangled:std::__detail::__to_chars_10_impl<unsigned int>(char*, unsigned int, unsigned int)::__digits
)(there are many more, but the list above gives a flavor of what i'm seeing)
The text was updated successfully, but these errors were encountered: