c运行时不可思议,独立库

发布于 2025-01-19 13:42:58 字数 368 浏览 2 评论 0原文

特别是在MSVC中,是否可以构建不需要该项目的库来使用C ++运行时的特定版本?如果是这样,如何实现这样的壮举?

我想构建一个包含一个简单函数f的库,该函数又来自某些版本的MSVC CRT呼叫函数,并从其他第三方库中调用函数。最终产品应该是我可以链接到我喜欢的任何项目的库,而不会引起CRT版本的冲突,或者抱怨重新定义的CRT符号,或者抱怨图书馆消耗的第三方依赖项中缺少符号。

换句话说,我想完成函数实现的详细信息f,仅导出f本身。

如果根本没有这样的事情,请提供有关为什么不可行的解释。我对extern“ c”等其他限制开放,或者要求库为dll而不是静态库。

Specifically in MSVC, is it possible to build a library that doesn't require the project that consumes it to use a specific version of the C++ runtime? If so, how would such a feat be accomplished?

I would like to build a library containing, for example, a simple function F that in turn calls functions from some version of the MSVC CRT, as well as calling functions from other 3rd-party libraries. The end product should be a library that I can link to any project I like, without causing conflicts in CRT versions, or complaining about redefined CRT symbols, or complaining about missing symbols from 3rd party dependencies that the library consumes.

In other words, I would like to complete encapsulate the details of the implementation of function F, exporting only F itself.

If such a thing is not at all possible, please provide an explanation as to why it is not feasible. I am open to additional restrictions such as extern "C" or requiring that the library be a dll rather than a static library.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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