Error: internal error: invalid thread id

This error seems to show up whenever Visual Studio, PGI Fortran and OpenMP are all involved together. Is there some OpenMP initialization that we need to do in C++ before calling Fortran?

Generate the error by enabling OpenMP in the PGI example:
$(VSInstallDir)\PGI Visual Fortran\Samples\interlanguage\vcmain_calling_pvfdll