From 71e064e5e6f005ebe52a52b717c90d1960805c87 Mon Sep 17 00:00:00 2001 From: kbr Date: Tue, 1 Aug 2006 23:22:55 +0000 Subject: Added NativeLibrary helper class to com.sun.gluegen.runtime package, principally to generally solve the problem of downloading dependent libraries of GlueGen-generated native code, as in the case of JOAL and OpenAL reported recently by Shawn Kendall on JOAL forums. Autogenerated Java and native code associated with this new NativeLibrary helper class is currently checked in to the GlueGen workspace to make it easier to build across multiple platforms; it can be regenerated by running the generate.nativelibrary.sources Ant target in the GlueGen workspace. Building of the native code in the GlueGen workspace is currently disabled by default and can be enabled by specifying -Dbuild.native=1 on the ant command line. Use of the new NativeLibrary class in JOAL is currently disabled by default and can be enabled by specifying -Djoal.use.gluegen=1 to applications using JOAL. New functionality has been lightly tested with JOAL on Windows and appears to be working. More testing, including build and Java Web Start deployment testing, to follow on other platforms. git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@241 03bf7f67-59de-4072-a415-9a990d468a3f --- src/java/net/java/games/joal/NativeLibLoader.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/java/net/java/games/joal/NativeLibLoader.java b/src/java/net/java/games/joal/NativeLibLoader.java index 394d1b4..011b1dd 100755 --- a/src/java/net/java/games/joal/NativeLibLoader.java +++ b/src/java/net/java/games/joal/NativeLibLoader.java @@ -38,10 +38,26 @@ package net.java.games.joal; import java.security.*; +import com.sun.gluegen.runtime.*; + class NativeLibLoader { static { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { + + boolean useGlueGen = + (System.getProperty("joal.use.gluegen") != null); + + if (useGlueGen) { + // Workaround for problems when OpenAL is not installed; + // want to be able to download the OpenAL shared library + // over e.g. Java Web Start and still link against it, so we + // have to use an alternate loading mechanism to work around + // the JDK's usage of RTLD_LOCAL on Unix platforms + NativeLibrary lib = NativeLibrary.open("OpenAL32", "openal", "openal", + NativeLibLoader.class.getClassLoader()); + } + // Workaround for problem in OpenAL32.dll, which is actually // the "wrapper" DLL which looks for real OpenAL // implementations like nvopenal.dll and "*oal.dll". -- cgit v1.2.3