Class Library


  • public final class Library
    extends java.lang.Object
    Represents a native library
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int GLOBAL
      All symbols in the library are made available to other libraries
      static int LAZY
      Perform lazy binding.
      static int LOCAL
      Symbols in this library are not made available to other libraries
      static int NOW
      Resolve all symbols when loading the library
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void finalize()  
      static Library getCachedInstance​(java.lang.String name, int flags)
      Gets a handle for the named library.
      static Library getDefault()
      Gets a handle to the default library.
      static java.lang.String getLastError()
      Gets the current error string from dlopen/LoadLibrary.
      long getSymbolAddress​(java.lang.String name)
      Gets the address of a symbol within the Library.
      static Library openLibrary​(java.lang.String name, int flags)
      Gets a handle for the named library.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LAZY

        public static final int LAZY
        Perform lazy binding. Only resolve symbols as needed
        See Also:
        Constant Field Values
      • NOW

        public static final int NOW
        Resolve all symbols when loading the library
        See Also:
        Constant Field Values
      • LOCAL

        public static final int LOCAL
        Symbols in this library are not made available to other libraries
        See Also:
        Constant Field Values
      • GLOBAL

        public static final int GLOBAL
        All symbols in the library are made available to other libraries
        See Also:
        Constant Field Values
    • Method Detail

      • getDefault

        public static final Library getDefault()
        Gets a handle to the default library.
        Returns:
        A Library instance representing the default library.
      • getCachedInstance

        public static final Library getCachedInstance​(java.lang.String name,
                                                      int flags)
        Gets a handle for the named library.
        Parameters:
        name - The name or path of the library to open.
        flags - The library flags (e.g. LAZY, NOW, LOCAL, GLOBAL)
        Returns:
        A Library instance representing the named library, or null if the library could not be opened.
      • openLibrary

        public static final Library openLibrary​(java.lang.String name,
                                                int flags)
        Gets a handle for the named library. Note This will not cache the instance, nor will it return a cached instance. Only use when you really need a new handle for the library.
        Parameters:
        name - The name or path of the library to open.
        flags - The library flags (e.g. LAZY, NOW, LOCAL, GLOBAL)
        Returns:
        A Library instance representing the named library, or null if the library cannot be opened.
      • getSymbolAddress

        public final long getSymbolAddress​(java.lang.String name)
        Gets the address of a symbol within the Library.
        Parameters:
        name - The name of the symbol to locate.
        Returns:
        The address of the symbol within the current address space.
      • getLastError

        public static final java.lang.String getLastError()
        Gets the current error string from dlopen/LoadLibrary.
        Returns:
        A String describing the last error.
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable