删除dll中对CRT的依赖

发布于 2024-12-23 06:46:27 字数 339 浏览 1 评论 0原文

我正在 Visual Studio 2010 上构建一个 dll,并使用一些简单的 C 函数,例如 fprintffread,它链接到 msvcr100.dll< /代码> 默认情况下。

该 dll 将被加载到可能使用不同 CRT 版本的应用程序中(例如 msvcr90.dllmsvcrt.dll)。

由于我知道应用程序将在加载 dll 之前加载 CRT,因此我可以删除对 msvcr100.dll 的依赖并使用应用程序加载的 CRT 中的 C 函数吗?

I'm building a dll on Visual Studio 2010, and I'm using some simple C functions like fprintf and fread, and it's linking to msvcr100.dll by default.

This dll is going to be loaded into an app that may be using a different CRT version (eg. msvcr90.dll, msvcrt.dll).

Since I know the app's going to load a CRT before my dll gets loaded, can I remove the dependency on msvcr100.dll and use the C functions in the CRT loaded by the app?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

以往的大感动 2024-12-30 06:46:27

最后,我决定根据目标应用程序使用的最低公分母 CRT 版本 msvcr90.dll 构建 DLL。

我通过使用 Visual C++ 2008 Express(免费)中提供的 MSVC 工具链来完成此操作。

我确实尝试了 mingw/gcc 工具链,它允许您指定要链接的 CRT 版本(请参阅 mingw-rtgcc -specs=msvcr**),但是,msvcr90.dll 是一种新型 SxS 程序集,因此我无法使生成的可执行文件正常运行。

可能值得考虑完全跳过对 msvcr**.dll 的链接;请参阅这篇文章VC/include/delayhlp.cpp

In the end, I decided to build the DLL against the lowest common denominator CRT version used by the target app, msvcr90.dll.

I did this by using the MSVC toolchain, available with Visual C++ 2008 Express (free).

I did try the mingw/gcc toolchain, which allows you to specify which CRT version to link against (see mingw-rt and gcc -specs=msvcr**), however, msvcr90.dll is a new-style SxS assembly so I couldn't get the produced executable to run properly.

It may be worth considering skipping linking against msvcr**.dll entirely; see this post and VC/include/delayhlp.cpp.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文