`strlen` is part of the list of C API banned by Microsoft.
Also rename a local variable in `Runtime.cs` so grepping the source
files won't show `strlen` outside the `tests` subdirectories.
* NSString can give us the length of the string
* NSData can copy memory into a supplied buffer
The later is already covered by tests in `tests/linker/ios/link all/InternalsTest.cs`
This avoids the use of `strcpy`, `memcpy` and `strlen` which can be
misused. We're already using ObjC code inside the file so we can
leverage higher-level API that makes review the code easier.
* [dotnet] Ship libxamarin.dylib and friends.
Add libxamarin[-debug].[a|dylib] to the NuGets.
* [dotnet] Create a DOTNET_PLATFORMS variable in Make.config.
Create a DOTNET_PLATFORMS variable in Make.config and use it everywhere
instead of the PLATFORMS variable we were defining in multiple Makefiles.
Also move the creation of the DOTNET_<platform>_RUNTIME_IDENTIFIERS variables
from dotnet/Makefile to Make.config, it'll soon be needed elsewhere as well.
* [runtime] Conditionally include bits.
* Make the contents of the DOTNET_[PLATFORMS|RUNTIME_IDENTIFIERS] variables depend on the INCLUDE_[IOS|TVOS|WATCH] variables.
We have better options for watchOS simulator and other platforms.
This only affects `lib*-debug.dylib` and `Xamarin-debug.framework`
as the non-debug binaries don't include debugging support.
That's in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/SDKs/Xamarin.macOS.sdk/[lib|include]
This allows for a bit more code share between mtouch and mmp.
These methods were already partially using GCHandles, so convert the parameter
using ObjectWrapper to GCHandle, and port the rest of the existing logic to
use the new helper API.
The native methods xamarin_get_[generic_]method_from_token are a bit unusual
in that they return an actual GCHandle. This is for performance reasons, since
in some cases their return value is passed as parameters to other function
calls to managed code, in which case we need the GCHandle. This way we avoid
round-tripping a GCHandle multiple times.
* Rearrange files in Xamarin.Mac a bit to ease code sharing between mmp and
mtouch, by putting mono's static and dynamic libraries in
/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Sdks/Xamarin.macOS.sdk
to match how Xamarin.iOS does it.
* Don't use 'usr' as an intermediate directory. This removes another special
case.
* Share many of the functions and properties that return specific directories,
and document (as comments) what each function/property is supposed to
return.
Also print out something to the system log. In theory
xamarin_process_managed_exception should also end up terminating the process
in one way or another, but when something goes wrong it tend to go very, very
wrong, so this makes sure some info is printed somewhere.
This is restricted to debug builds.
Also tell make to not delete delegates.h and delegates.inc. That makes it much
easier to inspect them.
Example before function:
void
xamarin_throw_ns_exception (NSException * exc)
{
delegates.throw_ns_exception (exc);
}
The after version:
void
xamarin_throw_ns_exception (NSException * exc)
{
#if DEBUG
if (delegates.throw_ns_exception == NULL) {
NSLog (@PRODUCT ": The managed function throw_ns_exception could not be loaded.");
xamarin_assertion_message ("The managed function throw_ns_exception could not be loaded.");
}
#endif
delegates.throw_ns_exception (exc);
}
* [mmp] Set 'disable_omit_fp' by default to provide better native stack traces in certain cases.
This may produce better stack traces when crashes occur, which could be
helpful for tracking down issues like
https://github.com/xamarin/maccore/issues/643.
Also add an mmp option to override the default behavior.
This is unlikely to cause any problems, because Visual Studio for Mac sets
MONO_DEBUG=disable_omit_fp at launch, which means that all processes launched
by VSMac will also have this variable set already.
* Fix lldb attach disabling.
We inject an x86-64 slice into binaries that don't contain one, because
Apple's notarization process fails without such a slice.
But make the slice optional and opt-in, because it seems Apple has started
to fail on binaries with such a slice now...