Class ForeignFunctions
java.lang.Object
oshi.ffm.ForeignFunctions
- Direct Known Subclasses:
CoreFoundationFunctions, DiskArbitrationFunctions, IOKitFunctions, MacSystemFunctions, WindowsForeignFunctions
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Linker.Optionstatic final StructLayoutprotected static final VarHandleprotected static final Arenaprotected static final Linkerprotected static final SymbolLookup -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MethodHandledowncall(SymbolLookup lib, String symbol, MemoryLayout resLayout, MemoryLayout... argLayouts) Create a downcall handle for a symbol in a library.static byte[]getByteArrayFromNativePointer(MemorySegment pointer, long length, Arena arena) static intgetErrno(MemorySegment callState) static StringgetStringFromNativePointer(MemorySegment pointer, Arena arena) static MemorySegmentgetStructFromNativePointer(MemorySegment pointer, StructLayout layout, Arena arena) static SymbolLookupLookup a library by name in the global arena.static SymbolLookuplibraryLookup(String libraryName)
-
Field Details
-
LINKER
-
LIBRARY_ARENA
-
SYMBOL_LOOKUP
-
CAPTURE_CALL_STATE
-
CAPTURED_STATE_LAYOUT
-
ERRNO_HANDLE
-
-
Constructor Details
-
ForeignFunctions
protected ForeignFunctions()
-
-
Method Details
-
libraryLookup
-
getStructFromNativePointer
public static MemorySegment getStructFromNativePointer(MemorySegment pointer, StructLayout layout, Arena arena) -
getStringFromNativePointer
-
getByteArrayFromNativePointer
-
lib
Lookup a library by name in the global arena.- Parameters:
name- the library name- Returns:
- the symbol lookup for the library
-
downcall
public static MethodHandle downcall(SymbolLookup lib, String symbol, MemoryLayout resLayout, MemoryLayout... argLayouts) Create a downcall handle for a symbol in a library.- Parameters:
lib- the symbol lookupsymbol- the symbol nameresLayout- the return layoutargLayouts- the argument layouts- Returns:
- the method handle
-
getErrno
-