c++的范围Abi Chages
我在 C++ 静态库中定义了以下符号:
struct P
{
int a;
#ifdef D1
int b;
#endif
};
class IInterface
{
public:
virtual void bad(int, P) = 0;
virtual void good(int, std::string) = 0;
};
并且我有链接所述静态库的可执行文件。 IInterface 实现驻留在我的可执行文件中,静态库通过 IInterface 使用我的实现。问题是 D1 在静态库和可执行文件中的定义不同。我想了解这个问题的范围。我想调用 bad() 是个坏主意。但是调用 good() 安全吗? 假设它的Linux环境和GCC被使用。我在哪里可以阅读有关这些内部结构的更多信息?是ELF格式规范吗?
所讨论的 ABI 更改是 P 的大小更改。库和可执行文件的其余部分完全相同。
I have following symbols defined in C++ static library:
struct P
{
int a;
#ifdef D1
int b;
#endif
};
class IInterface
{
public:
virtual void bad(int, P) = 0;
virtual void good(int, std::string) = 0;
};
And I have executable that links said static library. IInterface implementation resides in my executable and static library uses my implementation through IInterface. Problem is D1 was defined differently in static library and in executable. I want to grasp the scope of this problem. I guess calling bad() is bad idea. But is it safe to call good()?
Let's say its Linux environment and GCC was used. Where can I read more about these internals? Is it ELF format specs?
ABI change in question is the size change of P. All the rest is exactly the same for library and executable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论