Class Ffi

java.lang.Object
limn.backend.lwjgl.transfer.Ffi

public final class Ffi extends Object
Calling a C function, and being called by one, by a signature written as a string: p is a pointer or anything as wide (long, Atom, Window), i a 32-bit integer, and after > the result, v for none. It is libffi under LWJGL, and what spares the backend a native shim for a few dozen calls into Xlib, the C library and the Windows shell. Public for the backend's other packages; the module does not export this one.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    What a C caller is answered by: its arguments widened, and a result that is widened back.
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    call(long function, String signature, long... args)
    Calls a function.
    static org.lwjgl.system.Callback
    callback(String signature, Ffi.Handler handler)
    A C function that calls back into Java.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • call

      public static long call(long function, String signature, long... args)
      Calls a function.
      Parameters:
      function - its address
      signature - the argument types, >, the result type: "ppi>p"
      args - the arguments, each widened to a long
      Returns:
      the result, widened; 0 for v
    • callback

      public static org.lwjgl.system.Callback callback(String signature, Ffi.Handler handler)
      A C function that calls back into Java. The caller keeps it referenced and frees it.
      Parameters:
      signature - as for call(long, java.lang.String, long...)
      handler - what answers
      Returns:
      the callback, whose address() is the function pointer