OpenMP vcomp.dll problem

来源:互联网 发布:数据的作用 编辑:程序博客网 时间:2024/05/29 19:38

原文
http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/171ccf2b-7219-4012-ac2c-1ca22ee6778b

All VC Libs DLLs require manifests to load them. Manifest should be generated and embedded in the binary when the project is built in the IDE.

For OpenMP the manifest is generated when omp.h is included. There are cases where a dependency on vcomp.dll can be pulled in without using the header. In these cases the manifest may not be generated.

To generate the manifest, include omp.h and built your project. IDE built projects will automatically embed the manifest in the binary (unless the project settings were changed to disable it) 

If you are building from the command line then you can use the following to embed the manifest in the binary.

For EXEs
mt.exe -outputresource:<binary name>;1 -manifest <bianry name>.manifest

For DLLs
mt.exe -outputresource:<binary name>;2 -manifest <bianry name>.manifest

Following is a sample makefile with the changes to automatically embed the manifest in the binary.

...
MT_EXE=if exist $@.manifest mt.exe -outputresource:$@;1 -manifest$@.manifest $(ADDITIONAL_MANIFESTS)
 
MT_DLL=if exist $@.manifest mt.exe -outputresource:$@;2 -manifest$@.manifest $(ADDITIONAL_MANIFESTS)
 
#-manifest can be followed by any number of valid manifest files. mt.exe will merge them and if the merge does not result in any errors the resulting manifest is embedded.
 
all : b.dll a.exe
 
a.exe : a.obj
    link $(LINKER_FLAGS) $** /out:$@
    $(MT_EXE)
 
a.obj : a.cpp
    cl /MD a.cpp /c
 
b.dll : b.cpp
    cl /MD b.cpp /LD
    $(MT_DLL)

Once you have the manifest for your app you can deploy vcomp.dll 
1. Shared location (%SYSTEMROOT%\WinSXS)
a. Using vcredist.exe - Installs all the VC DLLs
b. By merging the OMP MSM into your setup
2. Applocal install
Copy the OpenMP directory under VC\redist\<platform> as a subdirectory of the app directory.

http://msdn2.microsoft.com/zebw5zk9(en-US,VS.80).aspx has the deployment details.

Sridhar Madhugiri
Software Engineer
Visual C++

原创粉丝点击