summaryrefslogtreecommitdiffstats
path: root/src/java/net
diff options
context:
space:
mode:
authorkbr <[email protected]>2006-12-05 22:03:54 +0000
committerkbr <[email protected]>2006-12-05 22:03:54 +0000
commit992a2674d8df645d33b3f027c595c35aa9a53dca (patch)
treeeb31949dd442c488989e4029268bba0be84576c2 /src/java/net
parentb3bb889d4c20c82c20c904e07abf386584146884 (diff)
Added file missed during last checkin
git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@375 03bf7f67-59de-4072-a415-9a990d468a3f
Diffstat (limited to 'src/java/net')
-rwxr-xr-xsrc/java/net/java/games/joal/impl/NativeLibLoader.java85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/java/net/java/games/joal/impl/NativeLibLoader.java b/src/java/net/java/games/joal/impl/NativeLibLoader.java
new file mode 100755
index 0000000..8a240a1
--- /dev/null
+++ b/src/java/net/java/games/joal/impl/NativeLibLoader.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ */
+
+package net.java.games.joal.impl;
+
+import java.security.*;
+
+import com.sun.gluegen.runtime.*;
+
+public class NativeLibLoader {
+ private static volatile boolean loadingEnabled = true;
+ private static volatile boolean didLoading;
+
+ private NativeLibLoader() {}
+
+ public static void disableLoading() {
+ loadingEnabled = false;
+ }
+
+ public static void enableLoading() {
+ loadingEnabled = true;
+ }
+
+ public static void load() {
+ if (!didLoading && loadingEnabled) {
+ synchronized (NativeLibLoader.class) {
+ if (!didLoading && loadingEnabled) {
+ didLoading = true;
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ // Workaround for problem in OpenAL32.dll, which is actually
+ // the "wrapper" DLL which looks for real OpenAL
+ // implementations like nvopenal.dll and "*oal.dll".
+ // joal.dll matches this wildcard and a bug in OpenAL32.dll
+ // causes a call through a null function pointer.
+ System.loadLibrary("joal_native");
+
+ // Workaround for 4845371.
+ // Make sure the first reference to the JNI GetDirectBufferAddress is done
+ // from a privileged context so the VM's internal class lookups will succeed.
+ // FIXME: need to figure out an appropriate entry point to call
+ // JAWT jawt = new JAWT();
+ // JAWTFactory.JAWT_GetAWT(jawt);
+
+ return null;
+ }
+ });
+ }
+ }
+ }
+ }
+}