Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  [RFE] possibility to disable library loading  (Read 609 times)
0 Members and 2 Guests are viewing this topic.
Offline skoehler

JGO n00b
*

Posts: 2



« on: 2005-02-11 14:52:08 »

The mechanism to load the jogl.dll or the libjogl.so files currently implemented in JOGL is suboptimal. Using System.loadLibrary works, but only the library is in found within a given path.

I've written a library loader, that is abled to
a) load jogl.dll / libjogl.so from a JAR/folder in the classpath
b) look for libjogl.so / jogl.dll in a place depending on the architechture (one is abled to put _all_ native libraries for _all_ architechtures supported into one JAR file or folder)

Well, for that loader to work, i have to disable JOGL own mechnism to load jogl.dll / libjogl.so.

Since all classes that need the native library call the load() method of the class NativeLibLoader, the following drop-in replacement will work and provide backward compatibility:

package net.java.games.jogl.impl;

public class NativeLibLoader
{
     private static volatile boolean DO_LOADING = true;
     private static boolean DONE_LOADING = false;

     public static void disableLoading()
     {
           DO_LOADING = false;
     }

     public static void enableLoading()
     {
           DO_LOADING = true;
     }

     public static synchronized void load()
     {
           if (DO_LOADING && !DONE_LOADING)
           {
                 System.loadLibrary("jogl");
                 DONE_LOADING = true;
           }
     }
}

of course the line System.loadLibrary("jogl"); has to be replaced by the more complex code that is currently in the static constructor of the class NativeLibLoader.
Offline Ken Russell

JGO Kernel
*****

Posts: 3446
Medals: 3


Java games rock!


« Reply #1 on: 2005-02-11 18:55:56 »

Thanks for the patch. Could you please add it as an attachment to Issue 110?
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.07 seconds with 20 queries.