The ATL, MFC, Standard C++, and CRT libraries support the deployment model available on Windows XP, Windows Server 2003, and Windows Vista. The DLLs corresponding to all Visual C++ libraries have been grouped into several shared side-by-side assemblies and are installed into the native assembly cache, also called the WinSxS folder, under the operating system root directory. Similarly, while building a C++ application by using Visual C++, by default the compiler and the linker generate a manifest file that describes runtime dependencies of this application on Visual C++ libraries.

Visual C++ libraries cannot be used by a C/C++ application without a manifest binding the application to these libraries. If a C/C++ application that depends on a Visual C++ library does not use a manifest, then an attempt to load the Visual C++ library as a dependent DLL from the application-local folder will result in an error message indicating that this is an unsupported way of loading a Visual C++ library.

NoteNote

On versions of Windows that do not support deployment of shared side-by-side assemblies, such as Windows 98 and Windows 2000 Server, the Visual C++ libraries are installed in the System32 folder and WinSxS folder under the operating system root directory. This setup enables running Visual C++ applications on these operating system versions because they do not support manifest-based binding of applications to dependent DLLs. On these operating systems, when an application is loaded, the corresponding manifest file is ignored and the operating systems searches for dependent DLLs using paths set in the current running environment. However, on upgrading the operating system to a version that support manifest-based binding, such as Windows XP, Windows Server 2003, or Windows Vista, applications built with manifests start using the DLLs installed in the WinSxS folder.

This change to the deployment model of Visual C++ libraries prevents the problem of version conflicts between DLLs that occur when you add updates or configurations to a machine, and will allow support of side-by-side installation of two different Visual C++ toolsets. It will also allow you to produce reliable, self-describing applications and components that will not conflict with existing components. For more information on the advantages of new deployment model, please see Concepts of Isolated Applications and Side-by-side Assemblies. To learn about how this may impact deployment of existing native C++ applications, please refer to Redistributing Visual C++ Files.

Visual C++ libraries have been packaged in several shared side-by-side assemblies with corresponding manifest files.

Assembly Name

DLLs included in the assembly

Visual C++ Library

Microsoft.VC90.ATL

atl100.dll

Active Template Library

Microsoft.VC90.CRT

msvcr100.dll

msvcp100.dll

msvcm100.dll

C Runtime Library, release DLLs

Microsoft.VC90.DebugCRT

msvcr100d.dll

msvcp100d.dll

msvcm100d.dll

C Runtime Library, debug DLLs

Microsoft.VC90.MFC

mfc100.dll

mfcm100.dll

mfc100u.dll

mfcm100u.dll

Microsoft Foundation Classes, release DLLs

Microsoft.VC90.DebugMFC

mfc100d.dll

mfcm100d.dll

mfc100ud.dll

mfcm100ud.dll

Microsoft Foundation Classes, debug DLLs

Microsoft.VC90.MFCLOC

mfc100chs.dll

mfc100deu.dll

mfc100esn.dll

mfc100ita.dll

mfc100kor.dll

mfc100cht.dll

mfc100enu.dll

mfc100fra.dll

mfc100jpn.dll

mfc100rus.dll

Microsoft Foundation Classes, localized resources

Microsoft.VC90.OpenMP

vcomp100.dll

OpenMP Library, release DLLs

Microsoft.VC90.DebugOpenMP

vcomp100d.dll

OpenMP Library, debug DLLs

When you build applications with Visual C++ 2008, you may need to redistribute Visual C++ libraries and deploy the corresponding DLLs to customers' desktops. For more information please see Deployment (C++).

Feedback

# re: VS编译动态库无法直接运行,所需的其他文件说明(Visual C++ Libraries as Shared Side-by-Side Assemblies)  回复  更多评论   

2010-11-24 09:32 by 杨书童
在VS2005下用C++写的程序,在一台未安装VS2005的系统上,
用命令行方式运行,提示:
“系统无法执行指定的程序”
直接双击运行,提示:
“由于应用程序的配置不正确,应用程序未能启动,重新安装应用程序可能会纠正这个问题”

以前用VC6和VS2003的话, 如果缺少库文件,是会提示缺少“**.dll”,但是用VS2005却没有这样的提示。

自己实验了一下,感觉以下几种解决办法是可行的:
方法一:
在类似C:\Program Files\Microsoft Visual Studio 8\VC\redi
st\Debug_NonRedist\x86\Microsoft.VC80.DebugCRT 下找到了下列文件:

msvcm80d.dll
msvcp80d.dll
msvcr80d.dll
Microsoft.VC80.DebugCRT.manifest

把这几个文件拷贝到目标机器上,与运行程序同一文件夹或放到system32下,就可以正确运行了。

其他release版、MFC程序什么的都是拷redist下相应文件夹下的文件就可以了,文件夹后都有标识!

方法二:
修改编译选项,将/MD或/MDd 改为 /MT或/MTd,这样就实现了对VC运行时库的静态链接,在运行时就不再需要VC的dll了。

方法三:

工程-》属性-》配置属性-》常规-》MFC的使用,选择“在静态库中使用mfc”
这样生成的exe文件应该就可以在其他机器上跑了。

方法四:

你的vc8安装盘上找到再分发包vcredist_xxx.exe和你的程序捆绑安装

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理