Class DynamicLinkLoader


  • public class DynamicLinkLoader
    extends java.lang.Object
    Native bindings to <dlfcn.h>.
    • Method Detail

      • dlopen

        public static long dlopen​(@Nullable
                                  java.nio.ByteBuffer filename,
                                  int mode)
        
        public static long dlopen​(@Nullable
                                  java.lang.CharSequence filename,
                                  int mode)
        
        Loads the dynamic library file named by the null-terminated string filename and returns an opaque "handle" for the dynamic library. If filename is NULL, then the returned handle is for the main program.
        Parameters:
        filename - the name of the dynamic library to open, or NULL
        mode - a bitfield. One or more of:
        RTLD_LAZYRTLD_NOWRTLD_BINDING_MASKRTLD_NOLOADRTLD_DEEPBINDRTLD_GLOBAL
        RTLD_LOCALRTLD_NODELETE
      • ndlerror

        public static long ndlerror()
        Unsafe version of: dlerror()
      • dlsym

        public static long dlsym​(long handle,
                                 java.nio.ByteBuffer name)
        
        public static long dlsym​(long handle,
                                 java.lang.CharSequence name)
        
        Takes a "handle" of a dynamic library returned by dlopen(java.nio.ByteBuffer, int) and the null-terminated symbol name, returning the address where that symbol is loaded into memory. If the symbol is not found, in the specified library or any of the libraries that were automatically loaded by dlopen(java.nio.ByteBuffer, int) when that library was loaded, dlsym() returns NULL.
        Parameters:
        handle - the dynamic library handle
        name - the symbol name
      • ndlclose

        public static int ndlclose​(long handle)
        Unsafe version of: dlclose(long)
      • dlclose

        public static int dlclose​(long handle)
        Decrements the reference count on the dynamic library handle handle. If the reference count drops to zero and no other loaded libraries use symbols in it, then the dynamic library is unloaded.
        Parameters:
        handle - the dynamic library to close