Skip to content

Expose managed Main with NativeAOT when compiling the application as a static library #81097

Closed
@ivanpovazan

Description

@ivanpovazan

Description

In order to integrate Xamarin and NativeAOT when targeting iOS platforms the following scenario is used:

  • Xamarin acts as a hosting native application which is statically linked with NativeAOT runtime, AOTed managed application and all the required libraries.
  • Xamarin's startup sequence initialises NativeAOT runtime, the managed ObjCRuntime and invokes the managed Main method to start the application.

However, if the application is compiled as a static library with the ILCompiler, the managed Main method is not exposed to the native world.

To workaround this limitation, one could change the source code of the application and add a method with UnmanagedCallersOnlyAttribute that wraps the Main, but if we consider the experience of the end-user, there should be an automatic way of injecting the required code which would make the transition to NativeAOT seamless.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions