我选择哪个VC ++运行时版本 - 静态或动态? [英] Which VC++ runtime version do I choose - static or dynamic?

查看:222
本文介绍了我选择哪个VC ++运行时版本 - 静态或动态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个64位的in-proc VC ++ ATL COM服务器,基本上只是将所有调用重定向到一个out-proc COM服务器。所以我的COM服务器基本上什么都不做。

I'm developing a 64-bit in-proc VC++ ATL COM server that basically just redirects all calls to an out-proc COM server. So my COM server basically does nothing.

最初,它使用C ++运行时在DLL( / MD )。我注意到,当我部署在一个干净的64位Win2k3 regsvr32失败,并出现错误: LoadLibrary({fileName})失败 - 此应用程序无法启动,因为应用程序配置不正确。重新安装应用程序可能会解决此问题。

Initially it used the C++ runtime in a DLL (/MD compiler switch). I've noticed that when I deploy it on a clean 64-bit Win2k3 regsvr32 fails with an error: LoadLibrary({fileName}) failed – This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

Google帮助 - 问题是没有安装VC ++ 9运行时。即使msvcr90.dll与我的COM服务器在同一目录中,问题仍然存在。这是因为我想是因为如何搜索依赖库的工作原理 - 不要查看同一个目录,我需要在Windows \ System32或类似的msvcr90.dll。由于这是一个复杂的我的部署,我切换到使用静态链接的C ++运行时(/ MT编译器开关)。现在它部署好。 .dll文件的大小只有110k(45k),所以它不会打扰我。

Google helps - the problem is that VC++9 runtime is not installed. The problem persists even when msvcr90.dll is in the same directory as my COM server. That as I guess is because of how search for dependent libraries works - it doen't look into the same directory and I need the msvcr90.dll in Windows\System32 or the like. Since this is a complication to my deployment I switched to using the statically linked C++ runtime (/MT compiler switch). Now it deploys fine. The size of the .dll file is 110k only (was 45k) so it doesn't bother me.

现在我听说了很多关于它是多么糟糕,在一个进程中混合不同版本的C ++运行时 - CRT状态可以断开,地狱可以断开等等。我必须想到这一点,期望从改变/ MD到/ MT的问题,特别是因为我不知道COM服务器消费者使用什么版本?

Now I've heard a lot about how bad it is to mix different versions of C++ runtime in one process - CRT state can be broken, hell can break loose and so on. Do I have to think of this and expect problems from changing /MD to /MT especially since I don't know what version the COM server consumers are using?

推荐答案

据我所知,VS从VS2005开始就在VS中弃用了Static运行时。

As far as I know the Static runtime is deprecated in VS since VS2005.

问题是Visual C运行时是一个并行dll。也就是说,必须从 c:\windows\winsxs 目录中加载。这是为什么将它放置在同一目录中的原因不再有效。

The problem is that the Visual C Runtime is a side by side dll. That is it must be loaded from the c:\windows\winsxs directory. This is why placing it in the same directory is no longer works.

正确的解决方案是在客户端系统上安装正确的CRT可再发行组件。

The correct solution is to install the correct CRT redistributable on the client system.

请参见 http://msdn.microsoft。 com / en-us / library / ms235316.aspx 了解更多信息

这可能是正确的可再发行组件:
http://www.microsoft.com/downloads/ details.aspx?familyid = BD2A6171-E2D6-4230-B809-9A8D7548C1B6& displaylang = en

This might be the correct redistributable: http://www.microsoft.com/downloads/details.aspx?familyid=BD2A6171-E2D6-4230-B809-9A8D7548C1B6&displaylang=en

安装正确的程序会将运行时dll放入winsxs目录。

Installing the correct one will place the runtime dlls in the winsxs directory.

这篇关于我选择哪个VC ++运行时版本 - 静态或动态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆