unsafe static void InitializePlatform(InitializationOptions *options) { // BaseDirectory may not be set in some Mono embedded environments // so try some reasonable fallbacks in these cases. string basePath = AppDomain.CurrentDomain.BaseDirectory; if (!string.IsNullOrEmpty(basePath)) { basePath = Path.Combine(basePath, ".."); } else { basePath = Assembly.GetExecutingAssembly().Location; if (!string.IsNullOrEmpty(basePath)) { basePath = Path.Combine(Path.GetDirectoryName(basePath), ".."); } else { // The executing assembly location may be null if loaded from // memory so the final fallback is the current directory basePath = Path.Combine(Environment.CurrentDirectory, ".."); } } ResourcesPath = Path.Combine(basePath, "Resources"); FrameworksPath = Path.Combine(basePath, "Frameworks"); }
static unsafe void InitializeCoreCLRBridge(InitializationOptions *options) { if (options->xamarin_objc_msgsend != IntPtr.Zero) { ObjectiveCMarshal.SetMessageSendCallback(ObjectiveCMarshal.MessageSendFunction.MsgSend, options->xamarin_objc_msgsend); } if (options->xamarin_objc_msgsend_super != IntPtr.Zero) { ObjectiveCMarshal.SetMessageSendCallback(ObjectiveCMarshal.MessageSendFunction.MsgSendSuper, options->xamarin_objc_msgsend_super); } if (options->xamarin_objc_msgsend_stret != IntPtr.Zero) { ObjectiveCMarshal.SetMessageSendCallback(ObjectiveCMarshal.MessageSendFunction.MsgSendStret, options->xamarin_objc_msgsend_stret); } if (options->xamarin_objc_msgsend_super_stret != IntPtr.Zero) { ObjectiveCMarshal.SetMessageSendCallback(ObjectiveCMarshal.MessageSendFunction.MsgSendSuperStret, options->xamarin_objc_msgsend_super_stret); } delegate * unmanaged <void> beginEndCallback = (delegate * unmanaged <void>)options->reference_tracking_begin_end_callback; delegate * unmanaged <IntPtr, int> isReferencedCallback = (delegate * unmanaged <IntPtr, int>)options->reference_tracking_is_referenced_callback; delegate * unmanaged <IntPtr, void> trackedObjectEnteredFinalization = (delegate * unmanaged <IntPtr, void>)options->reference_tracking_tracked_object_entered_finalization; ObjectiveCMarshal.Initialize(beginEndCallback, isReferencedCallback, trackedObjectEnteredFinalization, UnhandledExceptionPropagationHandler); }
public static Arch Arch; // default: = Arch.DEVICE; unsafe static void InitializePlatform(InitializationOptions *options) { if (options->IsSimulator) { Arch = Arch.SIMULATOR; } UIApplication.Initialize(); }
unsafe static void InitializePlatform(InitializationOptions *options) { #if !__MACCATALYST__ && !NET if (options->IsSimulator) { Arch = Arch.SIMULATOR; } #endif UIApplication.Initialize(); }