Bug 110

Summary: NativeLibLoader should have a flag for loading the library
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: VERIFIED FIXED    
Severity: normal    
Priority: P3    
Version: 1   
Hardware: All   
OS: all   
Type: FEATURE SCM Refs:
Workaround: ---

Description Sven Gothel 2010-03-24 07:46:56 CET


---- Reported by s_koehler 2004-09-27 09:30:35 ----

Hi,

in java, you can easily load libraries from different places by using
System.load() instead of System.loadLibrary(). The problem is, that JOGL always
calls System.loadLibrary("jogl"), but i'd like to load the jogl library
manualle, so that i can extract it from a JAR first etc.

The needed changes are simple.
Please extend NativeLibLoad with a method to set the AUTOLOAD-flag. The flag may
be true by default. Move the code from the static Constructor to the
load()-method, and make the load-method check the AUTOLOAD-flag.



---- Additional Comments From s_koehler 2005-02-11 19:19:28 ----

Here's a Version of NativeLibLoader, that should work, since the load() Method
is called by all static-constructors of the classes that need the jogl native
library.

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;
		}
	}
}

The line System.loadLibraray("jogl"); is to be replaced by the more complex code
that is currently in the static constructor of the class NativeLibLoader. 



---- Additional Comments From kbr 2005-02-12 11:46:46 ----

Thanks for the patch. I've applied it and the changes (the new methods
NativeLibLoader.disableLoading() and NativeLibLoader.enableLoading()) will be
present in 1.1 b09. Note that these are methods in the "implementation" so they
might change in a future release.




---- Additional Comments From s_koehler 2005-02-12 12:34:05 ----

Thank you. I was aware of the fact that the NativeLibLoader is in the "impl"
package, and therefor things may change. One may think of a more official way to
disable/change the loading of the jogl library, but the current sollution is OK
for me.



--- Bug imported by sgothel@jausoft.com 2010-03-24 07:46 EDT  ---

This bug was previously known as _bug_ 110 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=110