GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
com.jogamp.common.jvm.JNILibLoaderBase Class Reference
Inheritance diagram for com.jogamp.common.jvm.JNILibLoaderBase:
Collaboration diagram for com.jogamp.common.jvm.JNILibLoaderBase:

Classes

interface  LoaderAction
 

Static Public Member Functions

static boolean isLoaded (final String libName)
 
static void addLoaded (final String libName)
 
static void disableLoading ()
 
static void enableLoading ()
 
static synchronized void setLoadingAction (final LoaderAction action)
 
static final boolean addNativeJarLibsJoglCfg (final Class<?>[] classesFromJavaJars)
 Loads and adds a JAR file's native library to the TempJarCache, calling JNILibLoaderBase#addNativeJarLibs(Class[], String) with default JOGL deployment configuration: More...
 
static boolean addNativeJarLibs (final Class<?>[] classesFromJavaJars, final String singleJarMarker)
 Loads and adds a JAR file's native library to the TempJarCache. More...
 

Static Public Attributes

static final boolean DEBUG
 

Static Protected Member Functions

static synchronized boolean loadLibrary (final String libname, final boolean ignoreError, final ClassLoader cl)
 Loads the library specified by libname, using the LoaderAction set by setLoadingAction(LoaderAction). More...
 
static synchronized void loadLibrary (final String libname, final String[] preload, final boolean preloadIgnoreError, final ClassLoader cl)
 Loads the library specified by libname, using the LoaderAction set by setLoadingAction(LoaderAction). More...
 

Static Protected Attributes

static final boolean PERF
 

Detailed Description

Definition at line 64 of file JNILibLoaderBase.java.

Member Function Documentation

◆ addLoaded()

static void com.jogamp.common.jvm.JNILibLoaderBase.addLoaded ( final String  libName)
static

Definition at line 145 of file JNILibLoaderBase.java.

◆ addNativeJarLibs()

static boolean com.jogamp.common.jvm.JNILibLoaderBase.addNativeJarLibs ( final Class<?>[]  classesFromJavaJars,
final String  singleJarMarker 
)
static

Loads and adds a JAR file's native library to the TempJarCache.


The native library JAR file's URI is derived as follows:

Where:

  • [1] is one of classesFromJavaJars
  • [2] is it's complete URI
  • [3] is it's base URI
  • [4] is the derived native JAR filename

Generic description:

  final Class<?>[] classesFromJavaJars = new Class<?>[] { Class1.class, Class2.class };
  JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all");

If Class1.class is contained in a JAR file which name includes singleJarMarker, here -all, implementation will attempt to resolve the native JAR file as follows:

  • ClassJar-all.jar to ClassJar-all-natives-os.and.arch.jar

Otherwise the native JAR files will be resolved for each class's JAR file:

  • Class1Jar.jar to Class1Jar-natives-os.and.arch.jar
  • Class2Jar.jar to Class2Jar-natives-os.and.arch.jar

Examples:

JOCL:

   // only: jocl.jar -> jocl-natives-os.and.arch.jar
   addNativeJarLibs(new Class<?>[] { JOCLJNILibLoader.class }, null, null );

JOGL:

  final ClassLoader cl = GLProfile.class.getClassLoader();
  // jogl-all.jar         -> jogl-all-natives-os.and.arch.jar
  // jogl-all-noawt.jar   -> jogl-all-noawt-natives-os.and.arch.jar
  // jogl-all-mobile.jar  -> jogl-all-mobile-natives-os.and.arch.jar
  // jogl-all-android.jar -> jogl-all-android-natives-os.and.arch.jar
  // nativewindow.jar     -> nativewindow-natives-os.and.arch.jar
  // jogl.jar             -> jogl-natives-os.and.arch.jar
  // newt.jar             -> newt-natives-os.and.arch.jar (if available)
  final String newtFactoryClassName = "com.jogamp.newt.NewtFactory";
  final Class<?>[] classesFromJavaJars = new Class<?>[] { NWJNILibLoader.class, GLProfile.class, null };
  if( ReflectionUtil.isClassAvailable(newtFactoryClassName, cl) ) {
      classesFromJavaJars[2] = ReflectionUtil.getClass(newtFactoryClassName, false, cl);
  }
  JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all");
Parameters
classesFromJavaJarsFor each given Class, load the native library JAR.
singleJarMarkerOptional string marker like "-all" to identify the single 'all-in-one' JAR file after which processing of the class array shall stop.
Returns
true if either the 'all-in-one' native JAR or all native JARs loaded successful or were loaded already, false in case of an error

Definition at line 397 of file JNILibLoaderBase.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addNativeJarLibsJoglCfg()

static final boolean com.jogamp.common.jvm.JNILibLoaderBase.addNativeJarLibsJoglCfg ( final Class<?>[]  classesFromJavaJars)
static

Loads and adds a JAR file's native library to the TempJarCache, calling JNILibLoaderBase#addNativeJarLibs(Class[], String) with default JOGL deployment configuration:

   return JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all");

If Class1.class is contained in a JAR file which name includes singleJarMarker -all, implementation will attempt to resolve the native JAR file as follows:

  • ClassJar-all.jar to ClassJar-all-natives-os.and.arch.jar

Otherwise the native JAR files will be resolved for each class's JAR file:

  • ClassJar1.jar to ClassJar1-natives-os.and.arch.jar
  • ClassJar2.jar to ClassJar2-natives-os.and.arch.jar
  • ..

Definition at line 323 of file JNILibLoaderBase.java.

Here is the call graph for this function:

◆ disableLoading()

static void com.jogamp.common.jvm.JNILibLoaderBase.disableLoading ( )
static

Definition at line 152 of file JNILibLoaderBase.java.

Here is the call graph for this function:

◆ enableLoading()

static void com.jogamp.common.jvm.JNILibLoaderBase.enableLoading ( )
static

Definition at line 156 of file JNILibLoaderBase.java.

Here is the call graph for this function:

◆ isLoaded()

static boolean com.jogamp.common.jvm.JNILibLoaderBase.isLoaded ( final String  libName)
static

Definition at line 141 of file JNILibLoaderBase.java.

◆ loadLibrary() [1/2]

static synchronized boolean com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary ( final String  libname,
final boolean  ignoreError,
final ClassLoader  cl 
)
staticprotected

Loads the library specified by libname, using the LoaderAction set by setLoadingAction(LoaderAction).


The implementation should ignore, if the library has been loaded already.

Parameters
libnamethe library to load
ignoreErrorif true, errors during loading the library should be ignored
cloptional ClassLoader, used to locate the library
Returns
true if library loaded successful

Definition at line 486 of file JNILibLoaderBase.java.

Here is the caller graph for this function:

◆ loadLibrary() [2/2]

static synchronized void com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary ( final String  libname,
final String[]  preload,
final boolean  preloadIgnoreError,
final ClassLoader  cl 
)
staticprotected

Loads the library specified by libname, using the LoaderAction set by setLoadingAction(LoaderAction).


Optionally preloads the libraries specified by preload.
The implementation should ignore, if any library has been loaded already.

Parameters
libnamethe library to load
preloadthe libraries to load before loading the main library if not null
preloadIgnoreErrorif true, errors during loading the preload-libraries should be ignored
cloptional ClassLoader, used to locate the library

Definition at line 502 of file JNILibLoaderBase.java.

◆ setLoadingAction()

static synchronized void com.jogamp.common.jvm.JNILibLoaderBase.setLoadingAction ( final LoaderAction  action)
static

Definition at line 160 of file JNILibLoaderBase.java.

Here is the caller graph for this function:

Member Data Documentation

◆ DEBUG

final boolean com.jogamp.common.jvm.JNILibLoaderBase.DEBUG
static

Definition at line 65 of file JNILibLoaderBase.java.

◆ PERF

final boolean com.jogamp.common.jvm.JNILibLoaderBase.PERF
staticprotected

Definition at line 66 of file JNILibLoaderBase.java.


The documentation for this class was generated from the following file: