Skip to content

Support marshalled delegates with NativeAOT on iOS platforms #82090

Closed
@ivanpovazan

Description

@ivanpovazan

NativeAOT supports marshalled delegates for platforms with hardened runtime by using a scheme of preallocated thunks which is available under the FEATURE_FIXED_POOL_THUNKS preprocessor directive. However, it seems the functions used by this scheme are implemented in assembler and are only supported on Windows:

Even though marshalled delegates are considered as a legacy feature, they can still be used in the user's code and even framework libraries (e.g., Xamarin: https://github.com/xamarin/xamarin-macios/blob/main/src/ObjCRuntime/Blocks.cs#L122) which means they have to be supported in some way.

As a final note, NativeAOT supports function pointers which are preferred over marshalled delegates, as they have better performance and smaller footprint at runtime. Xamarin codebase is in process of fully switching to function pointers: dotnet/macios#10470.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions