Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UnmanagedFunctionPointer] on delegates #1262

Open
Tracked by #1192
jonpryor opened this issue Sep 30, 2024 · 0 comments
Open
Tracked by #1192

[UnmanagedFunctionPointer] on delegates #1262

jonpryor opened this issue Sep 30, 2024 · 0 comments
Labels
enhancement Proposed change to current functionality generator Issues binding a Java library (generator, class-parse, etc.)
Milestone

Comments

@jonpryor
Copy link
Member

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);
@jonpryor jonpryor added this to the .NET 10 milestone Sep 30, 2024
@jpobst jpobst added enhancement Proposed change to current functionality generator Issues binding a Java library (generator, class-parse, etc.) labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Proposed change to current functionality generator Issues binding a Java library (generator, class-parse, etc.)
Projects
None yet
Development

No branches or pull requests

2 participants