[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [libvirt-java] [PATCH 09/65] jna: load virt-0 or virt library depending on the platform



On Windows, the libvirt DLL is called libvirt-0.dll. Trying to load
the "virt" library hence fails to find the file. Branch on the platform
and load "virt-0" if we're running on this OS, use "virt" otherwise.

Signed-off-by: Claudio Bley <cbley av-test de>
---
 src/main/java/org/libvirt/jna/Libvirt.java |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/libvirt/jna/Libvirt.java b/src/main/java/org/libvirt/jna/Libvirt.java
index 813f09b..1be7c4f 100644
--- a/src/main/java/org/libvirt/jna/Libvirt.java
+++ b/src/main/java/org/libvirt/jna/Libvirt.java
@@ -4,6 +4,7 @@ import com.sun.jna.Callback;
 import com.sun.jna.Library;
 import com.sun.jna.Native;
 import com.sun.jna.NativeLong;
+import com.sun.jna.Platform;
 import com.sun.jna.Pointer;
 import com.sun.jna.ptr.IntByReference;
 import com.sun.jna.ptr.LongByReference;
@@ -96,7 +97,7 @@ public interface Libvirt extends Library {
         void eventCallback(ConnectionPointer virConnectPtr, DomainPointer virDomainPointer, Pointer opaque) ;
     }
 
-    Libvirt INSTANCE = (Libvirt) Native.loadLibrary("virt", Libvirt.class);
+    Libvirt INSTANCE = (Libvirt) Native.loadLibrary(Platform.isWindows() ? "virt-0" : "virt", Libvirt.class);
 
     // Constants we need
     public static int VIR_UUID_BUFLEN = 16;
-- 
1.7.9.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]