您应该通过DLL揭露第三方库符号吗?

发布于 2025-01-31 03:56:06 字数 328 浏览 3 评论 0原文

我想知道您正在静态地将第三方库链接到您的DLL库。如果您的DLL包含标题中实现的一些功能(例如,如果您具有模板功能),并且这些功能调用您的第三方库(请考虑通用库,例如​​absl :: strappend()),则需要要么

  1. 通过.def模块或其他东西从您的DLL导出第三方库符号,或者
  2. 要求您的客户静态链接到第三方库。

两种解决方案似乎都有问题。如果您的客户碰巧链接到同一第三方库的代码,则第一个可以创建重复的符号。第二个意味着您的库不是独立的,并且可能会在您的客户可能在另一个版本上使用的第三方库中强加版本管理要求。这里有干净的解决方案吗?

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

  1. export the third party library symbols from your DLL via a .def module or something, or
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文