Class ProcAddressTable


  • public abstract class ProcAddressTable
    extends Object
    Superclass for all generated ProcAddressTables. A ProcAddressTable is a cache of pointers to the dynamically-linkable C functions this autogenerated Java binding has exposed. Some libraries such as OpenGL, OpenAL and others define function pointer signatures rather than statically linkable entry points for the purposes of being able to query at run-time whether a particular extension is available. This table acts as a cache of these function pointers. Each function pointer is typically looked up at run-time by a platform-dependent mechanism such as dlsym(), wgl/glXGetProcAddress(), or alGetProcAddress(). If the field containing the function pointer is 0, the function is considered to be unavailable and can not be called.
    Author:
    Kenneth Russel, Michael Bien, Sven Gothel
    See Also:
    FunctionAddressResolver, DynamicLookupHelper
    • Field Detail

      • DEBUG

        protected static boolean DEBUG
      • DEBUG_PREFIX

        protected static String DEBUG_PREFIX
      • debugNum

        protected static int debugNum
    • Constructor Detail

      • ProcAddressTable

        public ProcAddressTable()
    • Method Detail

      • isFunctionAvailable

        public final boolean isFunctionAvailable​(String functionName)
        Returns true only if non null function pointer to this function exists.
      • isFunctionAvailableImpl

        protected boolean isFunctionAvailableImpl​(String functionName)
                                           throws IllegalArgumentException
        This is a convenience method to query the native function existence by name.

        It lets you avoid having to manually compute the "PROCADDRESS_VAR_PREFIX + <functionName>" member variable name and look it up via reflection.

        Throws:
        IllegalArgumentException - if this function is not in this table.
      • getAddressFor

        public long getAddressFor​(String functionName)
                           throws SecurityException,
                                  IllegalArgumentException
        This is a convenience method to query the native function handle by name.

        It lets you avoid having to manually compute the "PROCADDRESS_VAR_PREFIX + <functionName>" member variable name and look it up via reflection.

        If a SecurityManager is installed, user needs link permissions for all libraries, i.e. for new RuntimePermission("loadLibrary.*");!

        Throws:
        IllegalArgumentException - if this function is not in this table.
        SecurityException - if user is not granted access for all libraries.
      • getNullPointerFunctions

        public final Set<String> getNullPointerFunctions()
        Returns all functions pointing to null.