JniEnvironment.Types.RegisterNatives Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| RegisterNatives(JniObjectReference, JniNativeMethodRegistration[]) |
Registers every entry in a managed native method registration array. |
| RegisterNatives(JniObjectReference, ReadOnlySpan<JniNativeMethod>) |
Registers JNI native methods using blittable JniNativeMethod structs with raw function pointers and UTF-8 name/signature pointers. Calls the JNI RegisterNatives function directly without delegate marshaling. |
| RegisterNatives(JniObjectReference, JniNativeMethodRegistration[], Int32) |
Registers a prefix of a managed native method registration array. |
RegisterNatives(JniObjectReference, JniNativeMethodRegistration[])
Registers every entry in a managed native method registration array.
public static void RegisterNatives(Java.Interop.JniObjectReference type, Java.Interop.JniNativeMethodRegistration[] methods);
static member RegisterNatives : Java.Interop.JniObjectReference * Java.Interop.JniNativeMethodRegistration[] -> unit
Parameters
- type
- JniObjectReference
The Java class reference used when there are registrations.
- methods
- JniNativeMethodRegistration[]
The native method registrations, or null for none. Keep their delegates alive for all later JNI callbacks.
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
RegisterNatives(JniObjectReference, ReadOnlySpan<JniNativeMethod>)
Registers JNI native methods using blittable JniNativeMethod structs with raw function pointers and UTF-8 name/signature pointers. Calls the JNI RegisterNatives function directly without delegate marshaling.
public static void RegisterNatives(Java.Interop.JniObjectReference type, ReadOnlySpan<Java.Interop.JniNativeMethod> methods);
static member RegisterNatives : Java.Interop.JniObjectReference * ReadOnlySpan<Java.Interop.JniNativeMethod> -> unit
Parameters
- type
- JniObjectReference
A valid reference to the Java class that declares the native methods.
- methods
- ReadOnlySpan<JniNativeMethod>
The native method records to register.
Remarks
Name and signature pointers must contain zero-terminated modified UTF-8 and remain valid for this call. Function pointers and their callback targets must remain valid for all later JNI calls. A pending Java exception is converted to a managed exception; a nonzero JNI result without such an exception causes InvalidOperationException.
Applies to
RegisterNatives(JniObjectReference, JniNativeMethodRegistration[], Int32)
Registers a prefix of a managed native method registration array.
public static void RegisterNatives(Java.Interop.JniObjectReference type, Java.Interop.JniNativeMethodRegistration[] methods, int numMethods);
static member RegisterNatives : Java.Interop.JniObjectReference * Java.Interop.JniNativeMethodRegistration[] * int -> unit
Parameters
- type
- JniObjectReference
The Java class reference used when there are registrations.
- methods
- JniNativeMethodRegistration[]
The native method registrations, or null when the count is zero. Keep their delegates alive for all later JNI callbacks.
- numMethods
- Int32
The number of entries to register from the start of the array, from zero through its length.
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.