Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22045

msys mingw64 compiled library: A dynamic link library (DLL) initialization routine failed

$
0
0

I compiled native library using msys with compile flags -s -fomit-frame-pointer -fno-unwind-tables -fdata-sections -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -fstack-protector -fno-math-errno -Wl,--gc-sections -Wl,--strip-all -Wl,--add-stdcall-alias and also added target_link_libraries(myapp -static) in CMake

Everything works fine, but when i tried to run my native library on Windows Server 2019 Standard X64, i'm getting error

Exception in thread "main" java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: C:\Users\user\Desktop\lib\native.dll: A dynamic link library (DLL) initialization routine failed        at com.basic.app.SyntheticProtectedApplication.main(Unknown Source)Caused by: java.lang.UnsatisfiedLinkError: C:\Users\user\Desktop\lib\native.dll: A dynamic link library (DLL) initialization routine failed        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2394)        at java.base/java.lang.Runtime.load0(Runtime.java:755)        at java.base/java.lang.System.load(System.java:1953)        at com.basic.app.API$NativeBridge.<clinit>(API.java:170)        at com.basic.app.API.initialize(API.java:59)        ... 1 more

I tried to check if i don't have any dynamic libraries linked

But it seems like i don't have any external library, Dependencies app shows all modules are loaded correctly. My GCC version:

$ gcc --versiongcc.exe (Rev3, Built by MSYS2 project) 13.2.0Copyright (C) 2023 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

What may be the problem here? I want my library to be compatibile with all Windows versions.


Viewing all articles
Browse latest Browse all 22045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>