xamarin-macios/runtime
Rolf Bjarne Kvinge 5350fc3cd8 [runtime] Rework initialization for Xamarin.Mac extensions. (#2091)
* [runtime] Fix broken indentation to make code less confusing.

* [runtime] Rework initialization for Xamarin.Mac extensions.

1. Delay the Application.Init execution from step 6 in the initialization
   sequence, to when we'd run the managed Main function for a normal app. This
   makes the code a bit easier to reason about, since both code paths behave
   more similar. It's also matches the initialization documentation better
   (step 6 is "find the executable", not "find the executable and run
   Application.Init").

2. Install custom callbacks for mono's logging function just before calling
   Application.Init. We already install these custom callbacks in
   xamarin_initialize, but that doesn't help much if something goes wrong
   before xamarin_initialize is called (and there's no harm in doing this
   twice).

3. Treat the extension dll as an entry assembly, make the path to the entry
   assembly available to managed code, and load this assembly if
   Assembly.GetEntryAssembly can't find it (which happens for extensions,
   since there's no entry point as Assembly.GetEntryAssembly defines an entry
   assembly).

This fixes launching of Xamarin.Mac extensions.

* [runtime] Spaces -> tabs.
2017-05-11 17:44:58 +02:00
..
xamarin [runtime] Rework initialization for Xamarin.Mac extensions. (#2091) 2017-05-11 17:44:58 +02:00
.gitignore [mtouch/runtime] Implement support for tvOS extensions. 2016-04-25 18:15:02 -04:00
COOP.md Initial review pass for COOP for watchOS. 2016-05-26 17:47:10 +02:00
Delegates.cs.t4 [ObjCRuntime] Store a pointer to the initialization options in managed memory. (#1076) 2016-11-01 12:40:51 +01:00
EXCEPTIONS.md [runtime] Improve documentation about exceptions a little bit. 2016-06-08 20:11:07 +02:00
Makefile [mtouch] Fix compiling assemblies to frameworks on watchOS. (#2038) 2017-04-25 17:39:58 +02:00
README.md Initial review pass for COOP for watchOS. 2016-05-26 17:47:10 +02:00
Xamarin.framework-ios.Info.plist Create a Xamarin[-debug].framework. 2017-02-10 14:29:09 +01:00
Xamarin.framework-tvos.Info.plist Create a Xamarin[-debug].framework. 2017-02-10 14:29:09 +01:00
Xamarin.framework-watchos.Info.plist Create a Xamarin[-debug].framework. 2017-02-10 14:29:09 +01:00
bindings-generator.cs [modelio] Add missing MDLMesh constructors and fix xtro (#1826) 2017-03-28 10:08:12 -05:00
bindings-generator.csproj Build our runtime. 2016-04-24 14:47:24 -04:00
bindings.h [GameplayKit] Update from Xcode8 Beta 1 to Beta 6 (#689) 2016-08-30 15:32:46 -04:00
bindings.m [runtime] Use xamarin_process_nsexception instead of xamarin_throw_ns_exception in our generated bindings. (#84) 2016-05-26 13:36:56 +02:00
delegates.h.t4 Build our runtime. 2016-04-24 14:47:24 -04:00
delegates.inc.t4 Build our runtime. 2016-04-24 14:47:24 -04:00
delegates.t4 [registrar] Use metadata tokens instead of strings to find types and methods. (#1085) 2016-11-01 14:34:56 -04:00
exports.t4 [runtime] Rework initialization for Xamarin.Mac extensions. (#2091) 2017-05-11 17:44:58 +02:00
extension-main.m [mtouch/runtime] Implement support for tvOS extensions. 2016-04-25 18:15:02 -04:00
launcher.h Build our runtime. 2016-04-24 14:47:24 -04:00
launcher.m [runtime] Rework initialization for Xamarin.Mac extensions. (#2091) 2017-05-11 17:44:58 +02:00
libmonotouch.csproj Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
libxammac.csproj [Mac] Add support for os x extensions (#83) 2016-05-25 17:20:33 -04:00
main-internal.h [Mac] Add support for os x extensions (#83) 2016-05-25 17:20:33 -04:00
mono-runtime.h.t4 [runtime] Catch and process managed exceptions that are thrown in reverse P/Invoke (delegate) callbacks. 2016-06-08 20:05:54 +02:00
mono-runtime.m.t4 [runtime] Use printf on watchOS, NSLog doesn't shown up (by default) (#772) 2016-09-06 16:55:23 -04:00
monotouch-debug.h [runtime] Only enable debugging on watchOS devices if a native debugger is also attached. 2016-09-05 10:05:00 +02:00
monotouch-debug.m [runtime] Store the launch mode in a static variable. 2017-05-09 08:12:39 +02:00
monotouch-main.m [runtime] Store the launch mode in a static variable. 2017-05-09 08:12:39 +02:00
monotouch-support.h [runtime] Add dummy _stret symbols for iOS/ARM64 (#66) 2016-05-18 16:51:45 -04:00
nsstring-localization.m Build our runtime. 2016-04-24 14:47:24 -04:00
product.h Build our runtime. 2016-04-24 14:47:24 -04:00
runtime-internal.h [runtime] Make xamarin_open_assembly public and stable. (#2011) 2017-04-17 18:38:52 +02:00
runtime.m [runtime] Rework initialization for Xamarin.Mac extensions. (#2091) 2017-05-11 17:44:58 +02:00
shared.h Share the same block descriptors between copies of a block. Fixes #43592. (#683) 2016-08-26 19:22:38 +02:00
shared.m [runtime] Work around static analyzer warning about incorrect refcount decrement. (#1718) 2017-02-20 19:30:23 +01:00
slinked-list.h Build our runtime. 2016-04-24 14:47:24 -04:00
trampolines-i386-asm.s [runtime] Make the existing trampolines exception-aware. 2016-05-17 11:20:26 +02:00
trampolines-i386-objc_msgSend-copyframe.inc [runtime] Don't store xmm registers where we store other registers. 2016-05-17 11:24:02 +02:00
trampolines-i386-objc_msgSend-post.inc [runtime] Make sure the stack is correctly aligned to 16 bytes. 2016-05-17 11:24:03 +02:00
trampolines-i386-objc_msgSend-pre.inc [runtime] Make sure the stack is correctly aligned to 16 bytes. 2016-05-17 11:24:03 +02:00
trampolines-i386-objc_msgSend.s Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
trampolines-i386-objc_msgSendSuper.s Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
trampolines-i386-objc_msgSendSuper_stret.s Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
trampolines-i386-objc_msgSend_stret.s Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
trampolines-i386.h Build our runtime. 2016-04-24 14:47:24 -04:00
trampolines-i386.m [runtime] Make the clang's static analyzer happy. (#1722) 2017-02-20 17:20:13 +01:00
trampolines-internal.h [runtime] Handle any exceptions whenever we return from managed code. 2016-06-08 20:05:54 +02:00
trampolines-invoke.m [runtime] Make sure to always dispose objects that should be disposed, even if things go wrong. (#1725) 2017-02-20 19:29:56 +01:00
trampolines-varargs.h Build our runtime. 2016-04-24 14:47:24 -04:00
trampolines-varargs.m [runtime] Use printf on watchOS, NSLog doesn't shown up (by default) (#772) 2016-09-06 16:55:23 -04:00
trampolines-x86_64-asm.s [runtime] Make the existing trampolines exception-aware. 2016-05-17 11:20:26 +02:00
trampolines-x86_64-objc_msgSend-copyframe.inc Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
trampolines-x86_64-objc_msgSend-post.inc Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
trampolines-x86_64-objc_msgSend-pre.inc Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
trampolines-x86_64-objc_msgSend.s Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
trampolines-x86_64-objc_msgSendSuper.s Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
trampolines-x86_64-objc_msgSendSuper_stret.s Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
trampolines-x86_64-objc_msgSend_stret.s Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
trampolines-x86_64.h Build our runtime. 2016-04-24 14:47:24 -04:00
trampolines-x86_64.m [runtime] Make the clang's static analyzer happy. (#1722) 2017-02-20 17:20:13 +01:00
trampolines.m [runtime] Fix potential memory leak in error conditions. (#1723) 2017-02-20 19:35:40 +01:00
xamarin-support.m [runtime] Fix bug 52308 Console.WriteLine text is not showing in Device Log. (#1821) 2017-03-03 14:19:23 -06:00

README.md

Native runtime

This directory contains the native runtime for Xamarin.iOS and Xamarin.Mac.

Cooperative GC

See COOP.md

Generated code

A few files are generated automatically:

delegates.h|inc, Delegates.cs

These files contain the code required to glue the native runtime and the managed runtime.

mono-runtime.m, xamarin/mono-runtime.h

These files contain code that makes other code, consumers of the mono runtime, oblivious to whether the mono runtime is linked statically, dynamically, or using dlopen at runtime.

If you need to use a new function from the Mono headers, add it to exports.t4.

If you need a new enum / constant / typedef / etc, add it to mono-runtime.h.t4.

Shipped headers

These are the headers shipped with XI/XM (they're not for public consumption, but we need them to build generated code on customers machine, in particular main.m and registrar.m)

xamarin/runtime.h xamarin/trampolines.h xamarin/main.h xamarin/xamarin.h