Class ForeignFunctions

java.lang.Object
oshi.ffm.ForeignFunctions
Direct Known Subclasses:
CoreFoundationFunctions, DiskArbitrationFunctions, IOKitFunctions, MacSystemFunctions, WindowsForeignFunctions

public abstract class ForeignFunctions extends Object
  • Field Details

    • LINKER

      protected static final Linker LINKER
    • LIBRARY_ARENA

      protected static final Arena LIBRARY_ARENA
    • SYMBOL_LOOKUP

      protected static final SymbolLookup SYMBOL_LOOKUP
    • CAPTURE_CALL_STATE

      protected static final Linker.Option CAPTURE_CALL_STATE
    • CAPTURED_STATE_LAYOUT

      public static final StructLayout CAPTURED_STATE_LAYOUT
    • ERRNO_HANDLE

      protected static final VarHandle ERRNO_HANDLE
  • Constructor Details

    • ForeignFunctions

      protected ForeignFunctions()
  • Method Details

    • libraryLookup

      public static SymbolLookup libraryLookup(String libraryName)
    • getStructFromNativePointer

      public static MemorySegment getStructFromNativePointer(MemorySegment pointer, StructLayout layout, Arena arena)
    • getStringFromNativePointer

      public static String getStringFromNativePointer(MemorySegment pointer, Arena arena)
    • getByteArrayFromNativePointer

      public static byte[] getByteArrayFromNativePointer(MemorySegment pointer, long length, Arena arena)
    • lib

      public static SymbolLookup lib(String name)
      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 lookup
      symbol - the symbol name
      resLayout - the return layout
      argLayouts - the argument layouts
      Returns:
      the method handle
    • getErrno

      public static int getErrno(MemorySegment callState)