Barto22 commented on code in PR #18096: URL: https://github.com/apache/nuttx/pull/18096#discussion_r2718568810
########## libs/libxx/libcxx/nuttx_string_instantiations.cpp: ########## @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// Force emission of the std::__1::basic_string destructors for the +// character sets that NuttX enables. The upstream libc++ headers declare +// the relevant template instantiations as "extern", so without providing +// explicit definitions the linker cannot resolve references coming from +// locale-heavy translation units such as locale.cpp. + +#include <string> + +_LIBCPP_BEGIN_NAMESPACE_STD + +// Emit the full char specialization so all key functions (including dtors) +// are visible from libxx.a instead of remaining TU-local. +template class _LIBCPP_EXPORTED_FROM_ABI basic_string<char>; Review Comment: Because libcxx headers declare the relevant template instantiations as "extern", so without providing explicit definitions the linker cannot resolve references. If someone have some other idea how to resolve it, I'm open for changes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
