Bug 110 - NativeLibLoader should have a flag for loading the library
Summary: NativeLibLoader should have a flag for loading the library
Status: VERIFIED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 1
Hardware: All all
: P3 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2004-09-27 09:30 CEST by Sven Gothel
Modified: 2015-09-27 03:14 CEST (History)
0 users

See Also:
Type: FEATURE
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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