Make code compatible with jna 3.5.2 as well as 4.4.0

This commit is contained in:
chip@chipfraser.co.uk
2017-11-27 14:01:12 +00:00
parent 398515ca07
commit bbf413d48d
2 changed files with 5 additions and 6 deletions
@@ -17,10 +17,8 @@
package net.openhft.chronicle.hash.impl.util.jna;
import com.sun.jna.IntegerType;
import com.sun.jna.Native;
import com.sun.jna.Platform;
import com.sun.jna.Pointer;
import com.sun.jna.*;
import net.openhft.chronicle.core.OS;
import java.io.IOException;
@@ -36,7 +34,8 @@ public final class PosixMsync {
private static native int msync(Pointer addr, size_t length, int flags);
static {
Native.register(PosixMsync.class, Platform.C_LIBRARY_NAME);
NativeLibrary clib = NativeLibrary.getInstance(Platform.C_LIBRARY_NAME);
Native.register(PosixMsync.class, clib);
}
private PosixMsync() {}
@@ -50,7 +50,7 @@ public final class WindowsMsync {
// Finally calls FlushFileBuffers
raf.getChannel().force(false);
} else {
throw new IOException(Kernel32Util.formatMessage(lastError));
throw new IOException(Kernel32Util.formatMessageFromLastErrorCode(lastError));
}
}