Package limn.backend.lwjgl.transfer
Class Ffi
java.lang.Object
limn.backend.lwjgl.transfer.Ffi
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 ClassesModifier and TypeClassDescriptionstatic interfaceWhat a C caller is answered by: its arguments widened, and a result that is widened back. -
Method Summary
Modifier and TypeMethodDescriptionstatic longCalls a function.static org.lwjgl.system.Callbackcallback(String signature, Ffi.Handler handler) A C function that calls back into Java.
-
Method Details
-
call
Calls a function.- Parameters:
function- its addresssignature- the argument types,>, the result type:"ppi>p"args- the arguments, each widened to a long- Returns:
- the result, widened; 0 for
v
-
callback
A C function that calls back into Java. The caller keeps it referenced and frees it.- Parameters:
signature- as forcall(long, java.lang.String, long...)handler- what answers- Returns:
- the callback, whose
address()is the function pointer
-