Date: Thu, 18 Jul 2024 16:32:25 +0200
On 17/07/2024 22:49, Tiago Freire wrote:
> std::stable wouldn't fix this, if a vendor doesn't know that C++ interfaces are not portable across compilers, and is incapable of building an interface that actually works, they probably wouldn't be competent either to use std::stable::string instead of the plain old unportable std::string.
Nothing can definitively fix it, because compatibility demands that the
broken ways remain available. But at the same time...
(googles) "How do I make a C++ DLL?"
"To make a C++ DLL, use the standard mechanism for defining a public
interface. [LINK]"
They implement that, and then they try to pass an std::string, and get
an error: "C9001: using unstable type in a public interface."
Now they can look up C9001, and learn that they should use
std::stable::string instead. It's not a guarantee of success, but at
least there's a route open to them. Plus, once the concept of stability
is part of the standard, there's nothing stopping compilers from doing this:
(you) __declspec (dllexport) bool whatever (std::string &) { ... }
(compiler) "Warning C9002: using unstable type in DLL interface."
This, again informs them that there is a problem. Now they can look up
C9002 and learn about ABI differences.
Hans Guijt
> std::stable wouldn't fix this, if a vendor doesn't know that C++ interfaces are not portable across compilers, and is incapable of building an interface that actually works, they probably wouldn't be competent either to use std::stable::string instead of the plain old unportable std::string.
Nothing can definitively fix it, because compatibility demands that the
broken ways remain available. But at the same time...
(googles) "How do I make a C++ DLL?"
"To make a C++ DLL, use the standard mechanism for defining a public
interface. [LINK]"
They implement that, and then they try to pass an std::string, and get
an error: "C9001: using unstable type in a public interface."
Now they can look up C9001, and learn that they should use
std::stable::string instead. It's not a guarantee of success, but at
least there's a route open to them. Plus, once the concept of stability
is part of the standard, there's nothing stopping compilers from doing this:
(you) __declspec (dllexport) bool whatever (std::string &) { ... }
(compiler) "Warning C9002: using unstable type in DLL interface."
This, again informs them that there is a problem. Now they can look up
C9002 and learn about ABI differences.
Hans Guijt
Received on 2024-07-18 14:32:26