Skip to Main Content

UnsatisfiedLinkError: A dynamic link library (DLL) initialization routine

Michaelt-OracleNov 16 2011 — edited Nov 29 2011
I get this error only when building a native library with /MD on Win64.

Envrionment
Windows Server 2008 R2 (64 bit)

JDK1.6 (32 bit)
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode)

MS Visual Studio 2008
Microsoft (R) 32-bit C/C+ Optimizing Compiler Version 15.00.30729.01 for 80x86+

If I compile with "cl /O1 /EHsc /LD /IC:\Apps\Dvlp\jdk1.6.0\include /IC:\Apps\Dvlp\jdk1.6.0\include\win32 ..." then System.loadLibrary(...) succeeds.

If I compile with "cl */MD* /O1 /EHsc /LD /IC:\Apps\Dvlp\jdk1.6.0\include /IC:\Apps\Dvlp\jdk1.6.0\include\win32 ..." then System.loadLibrary(...) fails with "A dynamic link library (DLL) initialization routine failed."

After reading Microsoft's description of the /MD linker option I'm assuming this is a bitness issue but with my limited experience on Windows I'm afraid I'm stuck. Note, I must build with /MD, it's a requirement. Any suggestions on what to do next?

Edited by: user709182 on Nov 16, 2011 2:55 PM
Comments
Post Details
Added on Nov 16 2011
3 comments
1,881 views