zeromq / jzmq

Java binding for ZeroMQ
http://www.zeromq.org
GNU General Public License v3.0
590 stars 364 forks source link

Static linking jzmq library with other #383

Open NikitaFeodonit opened 9 years ago

NikitaFeodonit commented 9 years ago

I'm doing a project for Android, in which C++ core and Java interface. I do static linking jzmq library with project's kernel. For correct work of the Java part of jzmq library I have to apply this patch:

diff -Naur jzmq-old/src/main/java/org/zeromq/EmbeddedLibraryTools.java jzmq-new/src/main/java/org/zeromq/EmbeddedLibraryTools.java
--- jzmq-old/src/main/java/org/zeromq/EmbeddedLibraryTools.java 2015-05-31 11:53:03.848933900 +0200
+++ jzmq-new/src/main/java/org/zeromq/EmbeddedLibraryTools.java 2015-06-02 05:55:22.665874100 +0200
@@ -16,10 +16,13 @@

 public class EmbeddedLibraryTools {

-    public static final boolean LOADED_EMBEDDED_LIBRARY;
+    // changed for static linking with jzmq
+    //public static final boolean LOADED_EMBEDDED_LIBRARY;
+    public static final boolean LOADED_EMBEDDED_LIBRARY = false;

     static {
-        LOADED_EMBEDDED_LIBRARY = loadEmbeddedLibrary();
+        // commented for static linking with jzmq
+        //LOADED_EMBEDDED_LIBRARY = loadEmbeddedLibrary();
     }

     public static String getCurrentPlatformIdentifier() {
diff -Naur jzmq-old/src/main/java/org/zeromq/ZMQ.java jzmq-new/src/main/java/org/zeromq/ZMQ.java
--- jzmq-old/src/main/java/org/zeromq/ZMQ.java  2015-05-31 11:53:03.851934100 +0200
+++ jzmq-new/src/main/java/org/zeromq/ZMQ.java  2015-06-02 06:04:35.922200700 +0200
@@ -36,8 +36,9 @@

     static {
         // if no embedded native library, revert to loading from java.library.path
-        if (!EmbeddedLibraryTools.LOADED_EMBEDDED_LIBRARY)
-            System.loadLibrary("jzmq");
+        // commented for static linking with jzmq
+        //if (!EmbeddedLibraryTools.LOADED_EMBEDDED_LIBRARY)
+        //    System.loadLibrary("jzmq");
     }

     // Values for flags in Socket's send and recv functions.
@@ -526,8 +537,9 @@
         private static native void nativeInit();

         static {
-            if (!EmbeddedLibraryTools.LOADED_EMBEDDED_LIBRARY)
-                System.loadLibrary("jzmq");
+            // commented for static linking with jzmq
+            //if (!EmbeddedLibraryTools.LOADED_EMBEDDED_LIBRARY)
+            //    System.loadLibrary("jzmq");
             nativeInit();
         }
NikitaFeodonit commented 9 years ago

Please add support of library static linking to Java sources.