MeshLib Java Docs
Loading...
Searching...
No Matches

Static Public Member Functions

static synchronized java.lang.foreign.SymbolLookup lookup (java.lang.String group)
static java.lang.String nativePlatform ()
static java.lang.invoke.MethodHandle downcall (java.lang.String group, java.lang.String name, java.lang.foreign.FunctionDescriptor desc)
static long getCLong (java.lang.foreign.MemorySegment segment, long offset)
static void setCLong (java.lang.foreign.MemorySegment segment, long offset, long value)
static java.lang.foreign.MemorySegment ptr (Native object)
static java.lang.foreign.MemorySegment ptrNonNull (Native object, java.lang.String name)
static java.lang.foreign.MemorySegment alloc (java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.ValueLayout.OfBoolean layout, boolean value)
static java.lang.foreign.MemorySegment alloc (java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.ValueLayout.OfByte layout, byte value)
static java.lang.foreign.MemorySegment alloc (java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.ValueLayout.OfShort layout, short value)
static java.lang.foreign.MemorySegment alloc (java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.ValueLayout.OfInt layout, int value)
static java.lang.foreign.MemorySegment alloc (java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.ValueLayout.OfLong layout, long value)
static java.lang.foreign.MemorySegment alloc (java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.ValueLayout.OfFloat layout, float value)
static java.lang.foreign.MemorySegment alloc (java.lang.foreign.SegmentAllocator allocator, java.lang.foreign.ValueLayout.OfDouble layout, double value)
static java.lang.foreign.MemorySegment utf8 (java.lang.foreign.SegmentAllocator allocator, java.lang.String str)
static java.lang.foreign.MemorySegment end (java.lang.foreign.MemorySegment segment)
static java.lang.String string (java.lang.foreign.MemorySegment data, long size)
static java.lang.foreign.StructLayout structLayout (java.lang.String[] names, java.lang.foreign.MemoryLayout[] fields)
static void checkLayout (java.lang.foreign.StructLayout layout, long size, long alignment, java.lang.String name)
static java.lang.foreign.MemorySegment allocStruct (java.lang.foreign.MemoryLayout layout)
static java.lang.RuntimeException rethrow (java.lang.Throwable e)
static void checkException ()
static void callbackFailed (java.lang.Throwable error)
static java.lang.foreign.MemorySegment upcall (java.lang.invoke.MethodHandles.Lookup lookup, java.lang.Class<?> cls, java.lang.String name, java.lang.foreign.FunctionDescriptor desc)
static java.lang.foreign.MemorySegment newCallbackState (java.lang.Object callable)
static java.lang.Object callbackState (java.lang.foreign.MemorySegment userdata)

Static Public Attributes

static final java.lang.foreign.Linker LINKER = java.lang.foreign.Linker.nativeLinker()
static final java.lang.ref.Cleaner CLEANER = java.lang.ref.Cleaner.create()
static final boolean IS_WINDOWS = java.lang.System.getProperty("os.name", "").toLowerCase(java.util.Locale.ROOT).startsWith("windows")
static final java.lang.foreign.ValueLayout C_LONG = (IS_WINDOWS ? java.lang.foreign.ValueLayout.JAVA_INT : java.lang.foreign.ValueLayout.JAVA_LONG).withName("mrbind_c_long")
static final int PASS_BY_DEFAULT_CONSTRUCT = 0
static final int PASS_BY_COPY = 1
static final int PASS_BY_MOVE = 2
static final int PASS_BY_MOVE_AND_DESTROY = 3
static final int PASS_BY_DEFAULT_ARGUMENT = 4
static final int PASS_BY_NO_OBJECT = 5
static final java.lang.foreign.MemorySegment CALLBACK_STATE_STUB = upcall(java.lang.invoke.MethodHandles.lookup(), Ffi.class, "callbackStateChanged", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS))

Detailed Description

The runtime support of the bindings.

Member Function Documentation

◆ alloc() [1/7]

java.lang.foreign.MemorySegment meshlib.Ffi.alloc ( java.lang.foreign.SegmentAllocator allocator,
java.lang.foreign.ValueLayout.OfBoolean layout,
boolean value )
static

◆ alloc() [2/7]

java.lang.foreign.MemorySegment meshlib.Ffi.alloc ( java.lang.foreign.SegmentAllocator allocator,
java.lang.foreign.ValueLayout.OfByte layout,
byte value )
static

◆ alloc() [3/7]

java.lang.foreign.MemorySegment meshlib.Ffi.alloc ( java.lang.foreign.SegmentAllocator allocator,
java.lang.foreign.ValueLayout.OfDouble layout,
double value )
static

◆ alloc() [4/7]

java.lang.foreign.MemorySegment meshlib.Ffi.alloc ( java.lang.foreign.SegmentAllocator allocator,
java.lang.foreign.ValueLayout.OfFloat layout,
float value )
static

◆ alloc() [5/7]

java.lang.foreign.MemorySegment meshlib.Ffi.alloc ( java.lang.foreign.SegmentAllocator allocator,
java.lang.foreign.ValueLayout.OfInt layout,
int value )
static

◆ alloc() [6/7]

java.lang.foreign.MemorySegment meshlib.Ffi.alloc ( java.lang.foreign.SegmentAllocator allocator,
java.lang.foreign.ValueLayout.OfLong layout,
long value )
static

◆ alloc() [7/7]

java.lang.foreign.MemorySegment meshlib.Ffi.alloc ( java.lang.foreign.SegmentAllocator allocator,
java.lang.foreign.ValueLayout.OfShort layout,
short value )
static

◆ allocStruct()

java.lang.foreign.MemorySegment meshlib.Ffi.allocStruct ( java.lang.foreign.MemoryLayout layout)
static

Allocates zeroed memory for a struct. It's freed when the segment becomes unreachable.

◆ callbackFailed()

void meshlib.Ffi.callbackFailed ( java.lang.Throwable error)
static

Called by the callback trampolines when the Java callable throws. The exception is rethrown by the wrapper that made the C call.

◆ callbackState()

java.lang.Object meshlib.Ffi.callbackState ( java.lang.foreign.MemorySegment userdata)
static

The callable registered under a user data pointer.

◆ checkException()

void meshlib.Ffi.checkException ( )
static

Throws if the last call into the C bindings threw a C++ exception, or a Java callback threw.

◆ checkLayout()

void meshlib.Ffi.checkLayout ( java.lang.foreign.StructLayout layout,
long size,
long alignment,
java.lang.String name )
static

Checks a struct layout against the size and alignment the C bindings were generated with.

◆ downcall()

java.lang.invoke.MethodHandle meshlib.Ffi.downcall ( java.lang.String group,
java.lang.String name,
java.lang.foreign.FunctionDescriptor desc )
static

Creates the downcall handle of a C function. C long parameters and return values are widened to Java long. If the library lacks the function, the handle throws UnsatisfiedLinkError when called, so the other functions of its class stay usable.

◆ end()

java.lang.foreign.MemorySegment meshlib.Ffi.end ( java.lang.foreign.MemorySegment segment)
static

The end pointer of a segment allocated by utf8(). NULL for NULL.

◆ getCLong()

long meshlib.Ffi.getCLong ( java.lang.foreign.MemorySegment segment,
long offset )
static

◆ lookup()

synchronized java.lang.foreign.SymbolLookup meshlib.Ffi.lookup ( java.lang.String group)
static

The symbols of the library of a file group. The library is loaded on the first use from the libraries bundled in the jar (see bundledLibrary()), else from java.library.path (on Windows with LOAD_WITH_ALTERED_SEARCH_PATH, so its dependencies are found next to it before anything else: the directory of java.exe comes first in the default search order, and it has DLLs like freetype.dll that can shadow the real ones). If that fails, it's loaded with System.loadLibrary(), and then by its platform-specific file name through the system loader.

◆ nativePlatform()

java.lang.String meshlib.Ffi.nativePlatform ( )
static

<os>-<arch> of the libraries bundled for this platform, e.g. windows-x86_64, linux-aarch64, macos-aarch64 (the names of Rust's target_os and target_arch).

◆ newCallbackState()

java.lang.foreign.MemorySegment meshlib.Ffi.newCallbackState ( java.lang.Object callable)
static

Registers a callable and returns its user data pointer, with one reference.

◆ ptr()

java.lang.foreign.MemorySegment meshlib.Ffi.ptr ( Native object)
static

The pointer of a wrapper, or NULL for a null wrapper.

◆ ptrNonNull()

java.lang.foreign.MemorySegment meshlib.Ffi.ptrNonNull ( Native object,
java.lang.String name )
static

The pointer of a wrapper. Throws if the wrapper is null.

◆ rethrow()

java.lang.RuntimeException meshlib.Ffi.rethrow ( java.lang.Throwable e)
static

Converts a Throwable from invokeExact() to something that can be thrown from a method without a throws clause.

◆ setCLong()

void meshlib.Ffi.setCLong ( java.lang.foreign.MemorySegment segment,
long offset,
long value )
static

◆ string()

java.lang.String meshlib.Ffi.string ( java.lang.foreign.MemorySegment data,
long size )
static

Decodes a UTF-8 string from size bytes at data.

◆ structLayout()

java.lang.foreign.StructLayout meshlib.Ffi.structLayout ( java.lang.String[] names,
java.lang.foreign.MemoryLayout[] fields )
static

Builds a struct layout with the C alignment rules: each field is aligned naturally, and the struct is padded to its alignment.

◆ upcall()

java.lang.foreign.MemorySegment meshlib.Ffi.upcall ( java.lang.invoke.MethodHandles.Lookup lookup,
java.lang.Class<?> cls,
java.lang.String name,
java.lang.foreign.FunctionDescriptor desc )
static

Creates an upcall stub for a static method of cls. The lookup must be able to see the method.

◆ utf8()

java.lang.foreign.MemorySegment meshlib.Ffi.utf8 ( java.lang.foreign.SegmentAllocator allocator,
java.lang.String str )
static

Allocates the UTF-8 bytes of a string, without a null terminator. Returns NULL for null.

Member Data Documentation

◆ C_LONG

final java.lang.foreign.ValueLayout meshlib.Ffi.C_LONG = (IS_WINDOWS ? java.lang.foreign.ValueLayout.JAVA_INT : java.lang.foreign.ValueLayout.JAVA_LONG).withName("mrbind_c_long")
static

The layout of C long: 4 bytes on Windows, 8 bytes elsewhere. The name lets downcall() widen it to a Java long.

◆ CALLBACK_STATE_STUB

final java.lang.foreign.MemorySegment meshlib.Ffi.CALLBACK_STATE_STUB = upcall(java.lang.invoke.MethodHandles.lookup(), Ffi.class, "callbackStateChanged", java.lang.foreign.FunctionDescriptor.ofVoid(java.lang.foreign.ValueLayout.ADDRESS, java.lang.foreign.ValueLayout.ADDRESS))
static

◆ CLEANER

final java.lang.ref.Cleaner meshlib.Ffi.CLEANER = java.lang.ref.Cleaner.create()
static

◆ IS_WINDOWS

final boolean meshlib.Ffi.IS_WINDOWS = java.lang.System.getProperty("os.name", "").toLowerCase(java.util.Locale.ROOT).startsWith("windows")
static

◆ LINKER

final java.lang.foreign.Linker meshlib.Ffi.LINKER = java.lang.foreign.Linker.nativeLinker()
static

◆ PASS_BY_COPY

final int meshlib.Ffi.PASS_BY_COPY = 1
static

◆ PASS_BY_DEFAULT_ARGUMENT

final int meshlib.Ffi.PASS_BY_DEFAULT_ARGUMENT = 4
static

◆ PASS_BY_DEFAULT_CONSTRUCT

final int meshlib.Ffi.PASS_BY_DEFAULT_CONSTRUCT = 0
static

How an object is passed to a C function. Matches the C enum MR_PassBy.

◆ PASS_BY_MOVE

final int meshlib.Ffi.PASS_BY_MOVE = 2
static

◆ PASS_BY_MOVE_AND_DESTROY

final int meshlib.Ffi.PASS_BY_MOVE_AND_DESTROY = 3
static

◆ PASS_BY_NO_OBJECT

final int meshlib.Ffi.PASS_BY_NO_OBJECT = 5
static

The documentation for this class was generated from the following file: