-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[mono] Add iOS sample (AOT, arm64) #33633
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
Conversation
| // a kind of an animation | ||
| ios_set_text (msg.Substring (0, i + 1)); | ||
| await Task.Delay (100); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how text is animated (see gif)
| static os_log_t stdout_log; | ||
|
|
||
| /* These are not in public headers */ | ||
| typedef unsigned char* (*MonoLoadAotDataFunc) (MonoAssembly *assembly, int size, void *user_data, void **out_handle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lambdageek could this be fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes let's file an issue about this, we shouldn't need to rely on private functions.
| using System.Threading.Tasks; | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| public class MonoPInvokeCallbackAttribute : Attribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to avoid this and use NativeCallableAttribute
@vargaz could you please check where we are with the support of mono/mono#17479
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it basically same thing? but yeah NativeCallableAttribute sounds better.
|
Neat |
akoeplinger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good apart from a few nits.
| /* These are not in public headers */ | ||
| typedef unsigned char* (*MonoLoadAotDataFunc) (MonoAssembly *assembly, int size, void *user_data, void **out_handle); | ||
| typedef void (*MonoFreeAotDataFunc) (MonoAssembly *assembly, int size, void *user_data, void *handle); | ||
| void mono_install_load_aot_data_hook (MonoLoadAotDataFunc load_func, MonoFreeAotDataFunc free_func, void *user_data); | ||
| void mono_trace_init (void); | ||
| void mono_gc_init_finalizer_thread (void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #33736
See dotnet/runtime#33633 and https://github.com/xamarin/xamarin-macios/blob/master/runtime/exports.t4 * `mono_install_load_aot_data_hook` was already a `MONO_API`, but it was not in a public header. It is added to `mono/jit/mono-private-unstable.h` * `mono_gc_init_finalizer_thread` was [used by Xamarin.iOS](https://github.com/xamarin/xamarin-macios/blob/63ab48e679716264b33af00f86c24426da1d9f97/runtime/mono-runtime.h.t4#L278) for a long time without being in any public header. It's one of the reasons we have to compile Mono for XI with `--disable-visibility-hidden`. Make the function a proper `MONO_API` unconditionally - but make it do nothing if the runtime is compiled without `--with-lazy-thread-creation` (the default). It is now a public Mono API function. * `mono_trace_init` was a `MONO_API` function in a non-public header that was already used by embedders that need to set up logger hooks. It is now not necessary to call this before calling the logger functions to set up logger hooks such as `mono_trace_set_log_handler`
See dotnet/runtime#33633 and https://github.com/xamarin/xamarin-macios/blob/master/runtime/exports.t4 * `mono_install_load_aot_data_hook` was already a `MONO_API`, but it was not in a public header. It is added to `mono/jit/mono-private-unstable.h` * `mono_gc_init_finalizer_thread` was [used by Xamarin.iOS](https://github.com/xamarin/xamarin-macios/blob/63ab48e679716264b33af00f86c24426da1d9f97/runtime/mono-runtime.h.t4#L278) for a long time without being in any public header. It's one of the reasons we have to compile Mono for XI with `--disable-visibility-hidden`. Make the function a proper `MONO_API` unconditionally - but make it do nothing if the runtime is compiled without `--with-lazy-thread-creation` (the default). It is now a public Mono API function. * `mono_trace_init` was a `MONO_API` function in a non-public header that was already used by embedders that need to set up logger hooks. It is now not necessary to call this before calling the logger functions to set up logger hooks such as `mono_trace_set_log_handler` Co-authored-by: lambdageek <lambdageek@users.noreply.github.com>
I'd like to add a minimal Full AOT sample for iOS (to our
mono/netcore/sampledirectory).I decided to add it as an xcode project to be able to easily open & debug/deploy on a device.
Such samples are useful for experiments and debug purposes (I use it in order to debug issues in corefx tests).
Steps to run the sample:
However, xcode files are quite verbose so probably makes sense to generate the project via cmake.
What do you think @akoeplinger @steveisok @marek-safar do we need the sample in the repo?
UPD replaced with CMake.