From f1b6c2df45185ae29883daa3294d2e6516f5d656 Mon Sep 17 00:00:00 2001 From: Troels Bjerre Lund Date: Fri, 8 Dec 2023 11:43:45 +0000 Subject: [PATCH] Native: add missing stubs for objc for non-objc targets Kotlin code for Objective-C interop is always included to stdlib. It depends on some C++ code. The latter is compiled conditionally - only for targets supporting Objective-C interop. That might cause undefined symbols problems when DCE is not enabled. To deal with it, we usually have trivial stubs in C++ code, used for targets not supporting Objective-C interop. This commit adds a couple of such missing stubs. --- .../src/main/cpp/ObjCExportCoroutines.mm | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/kotlin-native/runtime/src/main/cpp/ObjCExportCoroutines.mm b/kotlin-native/runtime/src/main/cpp/ObjCExportCoroutines.mm index a41a2335709..0942ef4970e 100644 --- a/kotlin-native/runtime/src/main/cpp/ObjCExportCoroutines.mm +++ b/kotlin-native/runtime/src/main/cpp/ObjCExportCoroutines.mm @@ -3,16 +3,16 @@ * that can be found in the LICENSE file. */ +#import "Memory.h" +#import "ObjCExport.h" +#import "ObjCExportErrors.h" + #if KONAN_OBJC_INTEROP #import #import #import -#import "Memory.h" -#import "ObjCExport.h" -#import "ObjCExportErrors.h" - typedef void (^Completion)(id _Nullable, NSError* _Nullable); extern "C" void Kotlin_ObjCExport_runCompletionSuccess(KRef completionHolder, KRef result) { @@ -79,4 +79,18 @@ extern "C" void Kotlin_ObjCExport_resumeContinuation(KRef continuation, KRef res } } +#else + +extern "C" void Kotlin_ObjCExport_runCompletionSuccess(KRef completionHolder, KRef result) { + RuntimeAssert(false, "Unavailable operation"); +} + +extern "C" void Kotlin_ObjCExport_runCompletionFailure( + KRef completionHolder, + KRef exception, + const TypeInfo** exceptionTypes +) { + RuntimeAssert(false, "Unavailable operation"); +} + #endif