diff --git a/runtime/xamarin-support.m b/runtime/xamarin-support.m index 62186ad637ca..295b366d1c04 100644 --- a/runtime/xamarin-support.m +++ b/runtime/xamarin-support.m @@ -21,13 +21,22 @@ xamarin_log (const unsigned short *unicodeMessage) { // COOP: no managed memory access: any mode. +#if TARGET_OS_WATCH && defined (__arm__) // maybe make this configurable somehow? int length = 0; const unsigned short *ptr = unicodeMessage; while (*ptr++) length += sizeof (unsigned short); NSString *msg = [[NSString alloc] initWithBytes: unicodeMessage length: length encoding: NSUTF16LittleEndianStringEncoding]; - xamarin_printf ([msg UTF8String]); + const char *utf8 = [msg UTF8String]; + int len = strlen (utf8); + fwrite (utf8, 1, len, stdout); + if (len == 0 || utf8 [len - 1] != '\n') + fwrite ("\n", 1, 1, stdout); + fflush (stdout); [msg release]; +#else + NSLog (@"%S", unicodeMessage); +#endif } void*