OpenMP vcomp.dll problem

Hi everyone,

I have just bought and installed Visual Studio 2005 Pro, and I have a problem with its OpenMP support.

I have been using the Beta 2 before, and wrote code that uses OpenMP. As you might know, vcomp.dll is required when using OpenMP. The files can be found inside some redist folder of VS 2005. So I copy this file to the executable folder, and try to start the exe.

I get an error which says that it tries to load vcomp.dll wrong. However, I don't control the loading myself, so I assume this is a bug. Also it worked fine with the Beta. The Beta 2 vcomp.dll does work. But it causes some hang/lockup/deadlock somewhere, which didn't happen in the Beta.

Does anyone know what I should do Is it possible that they shipped a wrong DLL file with VS 2005 I copied the dll from the x86 redist folder. I tried all dll's I found actually, but none work, except the one of the Beta. And yes, I did rebuild everything :)

Cheers,
- John


Answer this question

OpenMP vcomp.dll problem

  • JamesWalshe

    Hi guys,

    Thanks for the detailed answers! It works now thanks to you guys.
    The problem was that I didn't include omp.h as I only used the pragmas.
    Thanks again for the help!

    Kind regards,
    - John

  • mickers

    This was exactly my problem. I suggest that the compiler should produce a warning or error when it encounters an OpenMP pragma if omp.h has not been included. Otherwise the compile succeeds but the program fails at runtime.

    Regards,

    T#


  • bexter

    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++


  • Ger van der Kamp

    Don't move vcomp.dll to the executable folder. In the final release of VS, your application should pick up the needed dll (vcomp.dll) from the SxS directory at
    %windir%\WinSxS.

    The manifest gets embeded into the application telling it to where exactly to pick up the dll. If the dll is picked up not from the SxS directory then you will get the error as in your case.

    For more details, take a look at http://msdn2.microsoft.com/en-us/library/ms235624.aspx

    Hope this helps!

    Thanks,
      Ayman Shoukry
      VC++ Team



  • Ben Fidge

    Thanks to you too. I've got the same problem. And it works now!

  • anjumahesh

    Thanks for the details here. I find it most exquisitely annoying that omp.h must be included for the manifest to be generated correctly. I was already explicitly linking with vcompd.lib, and that ought to be enough for the proper manifest generation. Seems like a bug to me.


  • SAMI_12

    So true, so true - #include <omp.h> helped me out too.

  • OpenMP vcomp.dll problem