Calling Golang from Java using JNI on Windows leads to "A dynamic link library (DLL) initialization routine failed"

GreNodge :

I created the following example project to test out calling Golang code from Java using JNI: https://github.com/blaubaer/golang-jni

When I call build.cmd I receive an error message like this:

Exception in thread "main" java.lang.UnsatisfiedLinkError: [...]\out\hello.dll: A dynamic link library (DLL) initialization routine failed
        at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
        at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
        at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
        at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2649)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
        at java.base/java.lang.System.loadLibrary(System.java:1867)
        at Hello.<clinit>(Hello.java:3)

Used environment:

  • Windows: 10.0.17763, Build 17763, 64bit
  • Golang: 1.11.5, windows/amd64
  • Java: 11.0.2 2019-01-15 LTS, 64-Bit
  • MinGW-w64: x86_64-8.1.0-win32-sjlj-rt_v6-rev0

Thanks!

GreNodge :

It seems to be related to a bug inside Golang itself. There is currently a Pull Request opened runtime: This change modifies Go to fix c-shared dll crash on x64 windows #30944 where I can approve that this will fix the issue.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Using GetDirectBufferAddress from JNI

From Javascript

Electron Uncaught Error: A dynamic link library (DLL) initialization routine failed

From Java

Calling into a saved java object via JNI from a different thread

From Java

Calling a DLL from an Applet via JNI

From Java

Calling Java method from JavaScript using ScriptEngine

From Java

Passing a pointer from JNI to Java using a long

From

Calling Golang from HTML

From

Golang/neoism: calling methods of objects returned by query leads to panic

From Dev

Calling a static void Java method from JNI

From Dev

Java JNI NullPointerException after calling method from C with valid pointers

From Dev

FMUException: Error loading the binary. Could not load the DLL: A dynamic link library (DLL) initialization routine failed

From Dev

Electron running SQLlite 3 on Windows - A dynamic link library (DLL) initialization routine failed

From Python

Cannot import from pywinauto: ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed

From Dev

calling a java constructor of same class from non static context leads to recursion but with static it works fine?

From Dev

Error while importing Tensorflow. A dynamic link library (DLL) initialization routine failed

From Dev

Call fortran dll from java using JNI

From Dev

Calling dll implemented JNI from C++

From Dev

Tensorflow : DLL load failed: A dynamic link library (DLL) initialization routine failed

From Dev

Trying to use win32ui with pywin32 gives: A dynamic link library (DLL) initialization routine failed

From Dev

JNI calling Java from C++ with multiple threads

From Dev

Calling C system calls from JNI

From Dev

Calling a Java Method from the native code using jni

From Dev

Calling java function from c++ using jni: Failed to find static method id

From Dev

JNI vs JNA, calling Java from Fortran95

From Dev

Calling Java Methods from JNI results in program crash

From Dev

Error while calling C# from java using jni4net from 64 bit Os

From Dev

Calling Python Eve from an Flask application leads to weird errors

From Dev

JNI: Calling a java method from C periodically is not working

From Dev

Calling RenderScript from C / JNI

Related Related

  1. 1

    Using GetDirectBufferAddress from JNI

  2. 2

    Electron Uncaught Error: A dynamic link library (DLL) initialization routine failed

  3. 3

    Calling into a saved java object via JNI from a different thread

  4. 4

    Calling a DLL from an Applet via JNI

  5. 5

    Calling Java method from JavaScript using ScriptEngine

  6. 6

    Passing a pointer from JNI to Java using a long

  7. 7

    Calling Golang from HTML

  8. 8

    Golang/neoism: calling methods of objects returned by query leads to panic

  9. 9

    Calling a static void Java method from JNI

  10. 10

    Java JNI NullPointerException after calling method from C with valid pointers

  11. 11

    FMUException: Error loading the binary. Could not load the DLL: A dynamic link library (DLL) initialization routine failed

  12. 12

    Electron running SQLlite 3 on Windows - A dynamic link library (DLL) initialization routine failed

  13. 13

    Cannot import from pywinauto: ImportError: DLL load failed while importing win32ui: A dynamic link library (DLL) initialization routine failed

  14. 14

    calling a java constructor of same class from non static context leads to recursion but with static it works fine?

  15. 15

    Error while importing Tensorflow. A dynamic link library (DLL) initialization routine failed

  16. 16

    Call fortran dll from java using JNI

  17. 17

    Calling dll implemented JNI from C++

  18. 18

    Tensorflow : DLL load failed: A dynamic link library (DLL) initialization routine failed

  19. 19

    Trying to use win32ui with pywin32 gives: A dynamic link library (DLL) initialization routine failed

  20. 20

    JNI calling Java from C++ with multiple threads

  21. 21

    Calling C system calls from JNI

  22. 22

    Calling a Java Method from the native code using jni

  23. 23

    Calling java function from c++ using jni: Failed to find static method id

  24. 24

    JNI vs JNA, calling Java from Fortran95

  25. 25

    Calling Java Methods from JNI results in program crash

  26. 26

    Error while calling C# from java using jni4net from 64 bit Os

  27. 27

    Calling Python Eve from an Flask application leads to weird errors

  28. 28

    JNI: Calling a java method from C periodically is not working

  29. 29

    Calling RenderScript from C / JNI

HotTag

Archive