-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[BUG] Should steer pybind11's internal ABI away from STL types to make them work cross-compiler #2773
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
Comments
FWIW I started hacking this out 🤷 /// Minimal container to have managed data for a C-string. This is done to
/// avoid having storage use `std::string` which might cause ABI issues across
/// different compiled "flavors" of the same version of pybind11 in the same
/// process.
class managed_cstr {
public:
managed_cstr() = default;
managed_cstr(const std::string& s)
: len_(s.size()) {
// Include null-terminator.
c_str_ = new char[len_ + 1];
std::memcpy(c_str_, s.data(), len_ + 1);
}
size_t hash() const {
return std::hash<std::string>(c_str_);
}
private:
size_t len_{};
char* c_str_{};
}; |
See Yannick's post here: #2772 (comment) |
Re-opening. Added Henry's overview to this issue's top-level post |
std::string
in py::detail::internals
cause ABI issues?
I've had a look at making
|
Shifting discussion from here:
#2772 (comment)
From @henryiii:
His expansion on this:
\cc @YannickJadoul @wjakob @rwgk
The text was updated successfully, but these errors were encountered: