Interface CLibrary

  • All Superinterfaces:
    com.sun.jna.Library

    public interface CLibrary
    extends com.sun.jna.Library
    This JNA interface provides functions in the C library.

    Usage Examples. Suppose you want to set the K2HDBGMODE enviroment "INFO" and print it, You could write this as:

    
     package ax.antpick;
    
     import com.sun.jna.*;
     import com.sun.jna.ptr.*;
    
     public class App {
       public static void main(String[] args) {
         CLibrary INSTANCE =
             (CLibrary) Native.synchronizedLibrary(Native.loadLibrary("c", CLibrary.class));
         INSTANCE.setenv("K2HDBGMODE", "INFO", 1);
         System.out.println(INSTANCE.getenv("K2HDBGMODE"));
       }
     }
     
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.sun.jna.Library

        com.sun.jna.Library.Handler
    • Field Summary

      • Fields inherited from interface com.sun.jna.Library

        OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER
    • Method Detail

      • free

        void free​(com.sun.jna.Pointer ptr)
        Frees the memory space pointed to by ptr
        Parameters:
        ptr - a pointer to be free
      • setenv

        int setenv​(String name,
                   String value,
                   int overwrite)
        Adds an enviroments
        Parameters:
        name - an environment string
        value - the value
        overwrite - if name already exists in the environment, then its value is changed to value if overwrite is nonzero. If overwrite is zero, then the value of name is not changed.
        Returns:
        returns zero on success, or -1 on error, with errno set to indicate the cause of the error.
      • unsetenv

        int unsetenv​(String name)
        Deletes an variable name from the environment.
        Parameters:
        name - an environment string
        Returns:
        returns zero on success, or -1 on error, with errno set to indicate the cause of the error.
      • getenv

        String getenv​(String name)
        Gets the value of an enviroment.
        Parameters:
        name - an environment string
        Returns:
        the value of an enviroment.