From 8b7460b7fd3172e35ac924f46991990642cb02b9 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Sun, 26 Mar 2017 22:10:27 +0100 Subject: [PATCH] Fixed Objective-C init support code to only be included in Obj-C compilation mode. --- support/mono_embeddinator.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/support/mono_embeddinator.c b/support/mono_embeddinator.c index 2fdd51a..c9606ca 100644 --- a/support/mono_embeddinator.c +++ b/support/mono_embeddinator.c @@ -34,11 +34,13 @@ #include #include -#ifdef __APPLE__ +#if defined(__APPLE__) #include #include #include +#endif +#if defined(__OBJC__) #include #include #endif @@ -63,7 +65,7 @@ void mono_m2n_set_context(mono_m2n_context_t* ctx) _current_context = ctx; } -#if defined(__APPLE__) +#if defined(__OBJC__) id allocAndInitAutoreleasePool() { Class NSAutoreleasePoolClass = objc_getClass("NSAutoreleasePool"); @@ -90,7 +92,7 @@ int mono_m2n_init(mono_m2n_context_t* ctx, const char* domain) mono_m2n_set_context(ctx); -#if defined(__APPLE__) +#if defined(__OBJC__) if (_autoreleasePool == AUTORELEASE_POOL_DEFAULT_VALUE) _autoreleasePool = allocAndInitAutoreleasePool(); #endif @@ -105,7 +107,7 @@ int mono_m2n_destroy(mono_m2n_context_t* ctx) mono_jit_cleanup (ctx->domain); -#if defined(__APPLE__) +#if defined(__OBJC__) if (_autoreleasePool != AUTORELEASE_POOL_DEFAULT_VALUE) { drainAutoreleasePool(_autoreleasePool);