[liblouis-liblouisxml] [liblouisutdml] push by mwhapples - Try loading dependency libraries in case compiled dynamically linked a... on 2014-10-07 14:28 GMT

  • From: liblouisutdml@xxxxxxxxxxxxxx
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Tue, 07 Oct 2014 14:28:41 +0000

Revision: c6355a464a59
Branch:   default
Author:   Michael Whapples
Date:     Tue Oct  7 14:27:33 2014 UTC
Log: Try loading dependency libraries in case compiled dynamically linked and included
https://code.google.com/p/liblouisutdml/source/detail?r=c6355a464a59

Modified:
 /java/src/org/liblouis/LibLouis.java
 /java/src/org/liblouis/LibLouisUTDML.java

=======================================
--- /java/src/org/liblouis/LibLouis.java        Tue Jul 15 09:13:24 2014 UTC
+++ /java/src/org/liblouis/LibLouis.java        Tue Oct  7 14:27:33 2014 UTC
@@ -20,7 +20,20 @@
"Could not load liblouis, libraryPath or librarySuffix not defined."
       );
     }
-    String libName = "liblouis" + librarySuffix;
+    String[] dependencyLibs = {"libiconv-2", "libxml2-2", "liblouis"};
+    String libName = null;
+    for (int i = 0; i < dependencyLibs.length; i++) {
+      libName = dependencyLibs[i] + librarySuffix;
+      if (!libraryPath.equals("")) {
+        libName = new File(libraryPath, libName).getAbsolutePath();
+      }
+      try {
+        System.load(libName);
+      } catch (Throwable t) {
+        // Do nothing, may be log it though
+      }
+    }
+    libName = "liblouisutdml" + librarySuffix;
     if (!libraryPath.equals(""))
     {
       libName = new File(libraryPath, libName).getAbsolutePath();
=======================================
--- /java/src/org/liblouis/LibLouisUTDML.java   Tue Jul 29 13:02:11 2014 UTC
+++ /java/src/org/liblouis/LibLouisUTDML.java   Tue Oct  7 14:27:33 2014 UTC
@@ -84,8 +84,6 @@

   public static void loadLibrary (String libraryPath, String
   librarySuffix) throws Exception {
-    if (libraryLoaded)
-      return;
     if (libraryPath == null || librarySuffix == null)
     {
       System.out.println("prefix or suffix is null");
@@ -93,14 +91,6 @@
       "Could not load libraries. libraryPath or librarySuffix undefined.");
     }
     LibLouis.loadLibrary(libraryPath, librarySuffix);
-    // System.load (libraryPath + "/liblouis" + librarySuffix);
-    String libName = "liblouisutdml" + librarySuffix;
-    if (!libraryPath.equals(""))
-    {
-      libName = new File(libraryPath, libName).getAbsolutePath();
-    }
-    System.load(libName);
-    libraryLoaded = true;
   }


For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts:

  • » [liblouis-liblouisxml] [liblouisutdml] push by mwhapples - Try loading dependency libraries in case compiled dynamically linked a... on 2014-10-07 14:28 GMT - liblouisutdml