其中VC ++运行时版本,我选择 - 静态还是动态? [英] Which VC++ runtime version do I choose - static or dynamic?

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

问题描述

我开发的基本上只是所有调用一个彻头彻尾的进程内COM服务器重定向64位的进程内VC ++ ATL 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({文件名})失败 - 此应用程序未能启动,因为应用程序配置不正确。重新安装应用程序可能会解决这个问题。

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.

谷歌帮助 - 问题是,未安装VC ++ 9运行。该问题仍然存在,即使MSVCR90.DLL是在同一目录作为我的COM服务器。这是我的猜测是因为如何搜索依赖库的工作 - 它doen't看看到同一个目录,我需要在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?

推荐答案

据我所知静态运行时是因为VS2005 pcated在VS德$ P $。

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 了解详情

这可能是正确的可再发行组件: <一href="http://www.microsoft.com/downloads/details.aspx?familyid=BD2A6171-E2D6-4230-B809-9A8D7548C1B6&displaylang=en" rel="nofollow">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

安装正确的那一个将运行时动态链接库中的winsxs文件目录。

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

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

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