消除了与 C++ 的编译器间不兼容问题; 动态库
...,此内容的后续内容。
从我对参考问题的回答中我了解到:
- 不同的编译器使用不同的名称修饰,这使得不可能在使用编译器 B 构建的项目中使用使用编译器 A 构建的 C++ 动态库,
- 该库可以构建为静态保存我在项目中包括 n 个头文件和源文件或导出符号。 (它仍然无法保存重建库以便与不同的编译器一起使用。)
根据上述内容仔细研究 SDL,我意识到它的链接有两层:在我的 SDL 项目中,我静态链接到 libSDL.a,而 libSDL.a 又会动态链接到 SDL.dll,从而消除了不同编译器对不同 .dll 版本的需要。
问题是这是否真的是这种情况以及问题的可行解决方案,还是我错过了一些东西(以及什么)?
..., a follow up to this.
From the answers I've been given to my referenced question I've learned that:
- different compilers use different name decoration, which makes it impossible to use a C++ dynamic library built with compiler A in a project built with compiler B,
- the library can be built as static saving me including n header and source files in the project or exporting symbols. (It still won't save rebuilding the library for use with a different compiler.)
Having a closer look at SDL in the light of what's been said, I've realized, that its linking has two layers: in my SDL project, I link statically against libSDL.a, which will, in turn, link dynamically against SDL.dll, thereby elminating the need for different .dll versions for different compilers.
The question is whether this is really the case and a viable solution to the problem, or am I missing something (and what)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你的做法是正确的。 我这样说:
extern C
使用 C++ 编译器进行编译)I think your approach is right. I'd put it this way:
extern C
)