Skip to content

[UnmanagedFunctionPointer] on delegates #1262

@jonpryor

Description

@jonpryor

Context: 2197579

NativeAOT doesn't like this by default. In order to convince
NativeAOT to support this, every delegate instance provided to
JniNativeMethodRegistration.Delegate must be of a delegate type
which has UnmanagedFunctionPointerAttribute. This coerces
NativeAOT to emit "stubs" for the referenced method, allowing things
to work with fewer changes.

For possible future NativeAOT support, every _JniMarshal_* delegate emitted by generator needs to have [UnmanagedFunctionPointer], a'la:

[UnmanagedFunctionPointer (CallingConvention.Winapi)]
delegate long _JniMarshal_PP_L (IntPtr env, IntPtr klass, long value);

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementProposed change to current functionalitygeneratorIssues binding a Java library (generator, class-parse, etc.)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions