Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.
1696 Discussions

LoadLibrary fails on libiomp5md.dll (v 11, win32), is there a workaround?

mariannagnedin
Beginner
647 Views
I amtrying to usethe C++ code that has been parallelized with OpenMP and compiled with Intel compiler 11,in the mixed language (C++/managed C++/C#) environment.
The C++ code is an \MD dll that statically links withIPP 6 library.The C++ dllis wrapped into the managed C++ wrapper dll (\CLR, \MD)which is referenced by a C# assembly. Everything works perfectly without OpenMP.
I parallelized the C++dll with OpenMP and it workswith C++ test executable.
However, when called from C# code, the whole thing crasheswhen the LoadLibrary is called by the framework on libiomp5md.dll. The error message is "Access violation reading location 0x00000000".
Could somebody help me? Is there a workaround around the LoadLibrary failure? I would appreciate any advice I can get.

I wrote some test code, and the LoadLibrary indeed fails on libiomp5md.dll, even without C#. I can not use any solution that requires \MT switch, since \CLR is not compatible with \MT.Idid place the libiomp5md.dll into the directory of my C# executable. I do have appropriate Intel directories added to my path. Myown dlls are safelyloaded by the framework before the loading of the Intel dll fails. I checked with dependency walker,and I do not seem to miss any of the dependencies.
0 Kudos
1 Reply
pvonkaenel
New Contributor III
647 Views
Quoting - mariannagnedin
I amtrying to usethe C++ code that has been parallelized with OpenMP and compiled with Intel compiler 11,in the mixed language (C++/managed C++/C#) environment.
The C++ code is an MD dll that statically links withIPP 6 library.The C++ dllis wrapped into the managed C++ wrapper dll (CLR, MD)which is referenced by a C# assembly. Everything works perfectly without OpenMP.
I parallelized the C++dll with OpenMP and it workswith C++ test executable.
However, when called from C# code, the whole thing crasheswhen the LoadLibrary is called by the framework on libiomp5md.dll. The error message is "Access violation reading location 0x00000000".
Could somebody help me? Is there a workaround around the LoadLibrary failure? I would appreciate any advice I can get.

I wrote some test code, and the LoadLibrary indeed fails on libiomp5md.dll, even without C#. I can not use any solution that requires MT switch, since CLR is not compatible with MT.Idid place the libiomp5md.dll into the directory of my C# executable. I do have appropriate Intel directories added to my path. Myown dlls are safelyloaded by the framework before the loading of the Intel dll fails. I checked with dependency walker,and I do not seem to miss any of the dependencies.

My guess is that LoadLibrary should not be needed on libiomp5md.dll (and it sounds dangerous to try since the compiler hooks into it). Suppose you have a C++ dll called myThrd.dll which has been threaded using OpenMP. Then myThrd.dll should perform load time dynamic linking with libiomp5md.dll and not run-time dynamic linking. Your managed C++ wrapper may use LoadLibrary on myThrd.dll, but should not be explicitly linking with libiomp5md.dll.

Againa guess:myThrd.dll is unable to find the libiomp5md.dll file at load-time and this is what's causing the crash. Not a problem with LoadLibrary on OpenMP.

Peter
0 Kudos
Reply