jnr.ffi.Variable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jnr-ffi Show documentation
Show all versions of jnr-ffi Show documentation
A library for invoking native functions from java
package jnr.ffi;
/**
* Access library global variables.
*
*
* To access global variables, declare a method with a parameterized return type of this class.
*
* Example
*
* {@code
*
* public interface MyLib {
* public Variable my_int_var();
* }
*
* MyLib lib = LibraryLoader.create(MyLib.class).load("mylib"):
* System.out.println("native value=" + lib.my_int_var().get())
*
* lib.my_int_var().set(0xdeadbeef);
* }
*
*
*/
public interface Variable {
/**
* Gets the current value of the global variable
*
* @return The value of the variable
*/
public T get();
/**
* Sets the global variable to a value
*
* @param value The value to set the global variable to.
*/
public void set(T value);
}