Uh oh!
There was an error while loading. Please reload this page.
[mono] Add iOS sample (AOT, arm64) - #33633
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.
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.
Yes let's file an issue about this, we shouldn't need to rely on private functions.
Uh oh!
There was an error while loading. Please reload this page.
| using System.Threading.Tasks; | ||
| using System.Runtime.InteropServices; | ||
| public class MonoPInvokeCallbackAttribute : Attribute |
There was a problem hiding this comment.
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.
Isn't it basically same thing? but yeah NativeCallableAttribute sounds better.
stephentoub
commented
Mar 17, 2020
Neat |
Uh oh!
There was an error while loading. Please reload this page.
akoeplinger
left a comment
There was a problem hiding this comment.
Looks good apart from a few nits.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| /* 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); |
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.