您应该通过DLL揭露第三方库符号吗?
我想知道您正在静态地将第三方库链接到您的DLL库。如果您的DLL包含标题中实现的一些功能(例如,如果您具有模板功能),并且这些功能调用您的第三方库(请考虑通用库,例如absl :: strappend()
),则需要要么
- 通过.def模块或其他东西从您的DLL导出第三方库符号,或者
- 要求您的客户静态链接到第三方库。
两种解决方案似乎都有问题。如果您的客户碰巧链接到同一第三方库的代码,则第一个可以创建重复的符号。第二个意味着您的库不是独立的,并且可能会在您的客户可能在另一个版本上使用的第三方库中强加版本管理要求。这里有干净的解决方案吗?
I'm wondering about a situation where you are statically linking a third party library to your DLL library. If your DLL includes some functions implemented in headers (like if you have template functions), and these functions call your third party library (think general purpose, like absl::StrAppend()
), then you need to either
- export the third party library symbols from your DLL via a .def module or something, or
- ask your client to statically link to the third party library.
Both solutions seem like problems. The first one could create duplicate symbols if your client happens to be linking against the same third party library for their own code. The second means your library isn't self-contained, and might impose versioning requirements on the third-party library that your client could be using at another version. Is there a clean solution here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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