From: Michael Koch Date: Tue, 21 Oct 2003 12:55:02 +0000 (+0000) Subject: ByteOrder.java, [...]: Add code to load library with code for native methods if needed. X-Git-Tag: releases/gcc-3.4.0~2851 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c4ff410a6ba8420e1f8083a779b0ed57014e7d1c;p=thirdparty%2Fgcc.git ByteOrder.java, [...]: Add code to load library with code for native methods if needed. 2003-10-21 Michael Koch * java/nio/ByteOrder.java, java/nio/DirectByteBufferImpl.java, java/nio/channels/FileChannelImpl.java: Add code to load library with code for native methods if needed. From-SVN: r72747 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 42087e120a19..f5bf330c9350 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2003-10-21 Michael Koch + + * java/nio/ByteOrder.java, + java/nio/DirectByteBufferImpl.java, + java/nio/channels/FileChannelImpl.java: + Add code to load library with code for native methods if needed. + 2003-10-21 Michael Koch * gnu/java/net/PlainDatagramSocketImpl.java, diff --git a/libjava/java/nio/ByteOrder.java b/libjava/java/nio/ByteOrder.java index f1001a33b71c..b4fcbe53a8be 100644 --- a/libjava/java/nio/ByteOrder.java +++ b/libjava/java/nio/ByteOrder.java @@ -38,6 +38,8 @@ exception statement from your version. */ package java.nio; +import gnu.classpath.Configuration; + /** * @author Michael Koch * @since 1.4 @@ -47,6 +49,15 @@ public final class ByteOrder public static final ByteOrder BIG_ENDIAN = new ByteOrder(); public static final ByteOrder LITTLE_ENDIAN = new ByteOrder(); + static + { + // load the shared library needed for native methods. + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary ("javanio"); + } + } + /** * Returns the native byte order of the platform currently running. */ diff --git a/libjava/java/nio/DirectByteBufferImpl.java b/libjava/java/nio/DirectByteBufferImpl.java index 4028b545d259..a54c20693feb 100644 --- a/libjava/java/nio/DirectByteBufferImpl.java +++ b/libjava/java/nio/DirectByteBufferImpl.java @@ -38,10 +38,20 @@ exception statement from your version. */ package java.nio; +import gnu.classpath.Configuration; import gnu.gcj.RawData; class DirectByteBufferImpl extends ByteBuffer { + static + { + // load the shared library needed for native methods. + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary ("javanio"); + } + } + RawData address; private int offset; private boolean readOnly; diff --git a/libjava/java/nio/channels/FileChannelImpl.java b/libjava/java/nio/channels/FileChannelImpl.java index 85113a0287b6..a14a7e1dd431 100644 --- a/libjava/java/nio/channels/FileChannelImpl.java +++ b/libjava/java/nio/channels/FileChannelImpl.java @@ -47,6 +47,7 @@ import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; import java.nio.MappedByteBufferImpl; +import gnu.classpath.Configuration; import gnu.gcj.RawData; /** @@ -59,6 +60,15 @@ import gnu.gcj.RawData; public class FileChannelImpl extends FileChannel { + static + { + // load the shared library needed for native methods. + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary ("javanio"); + } + } + public RawData map_address; int length;