Package org.graalvm.nativeimage.hosted
Class RuntimeForeignAccess
java.lang.Object
org.graalvm.nativeimage.hosted.RuntimeForeignAccess
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
registerForDowncall
(Object desc, Object... options) Registers the provided function descriptor and options pair at image build time for downcalls into foreign code.static void
registerForUpcall
(Object desc, Object... options) Registers the provided function descriptor and options pair at image build time for upcalls from foreign code.
-
Method Details
-
registerForDowncall
Registers the provided function descriptor and options pair at image build time for downcalls into foreign code. Required to get a downcall method handle usingLinker.downcallHandle(java.lang.foreign.MemorySegment, java.lang.foreign.FunctionDescriptor, java.lang.foreign.Linker.Option...)
PREVIEW for the same descriptor and options at runtime.Even though this method is weakly typed for compatibility reasons, runtime checks will be performed to ensure that the arguments have the expected type. It will be deprecated in favor of strongly typed variant as soon as possible.
- Parameters:
desc
- AFunctionDescriptor
PREVIEW to register for downcalls.options
- An array ofLinker.Option
PREVIEW used for the downcalls.- Since:
- 23.1
-
registerForUpcall
Registers the provided function descriptor and options pair at image build time for upcalls from foreign code. Required to get an upcall stub function pointer usingLinker.upcallStub(java.lang.invoke.MethodHandle, java.lang.foreign.FunctionDescriptor, java.lang.foreign.Arena, java.lang.foreign.Linker.Option...)
PREVIEW for the same descriptor and options at runtime.Even though this method is weakly typed for compatibility reasons, runtime checks will be performed to ensure that the arguments have the expected type. It will be deprecated in favor of strongly typed variant as soon as possible.
- Parameters:
desc
- AFunctionDescriptor
PREVIEW to register for upcalls.options
- An array ofLinker.Option
PREVIEW used for the upcalls.- Since:
- 24.1
-