From 954b7a3b51037c1ffa53f1e19c4931a08cb2cbcc Mon Sep 17 00:00:00 2001 From: Jan Petsche <58227040+janpetschexain@users.noreply.github.com> Date: Wed, 9 Jun 2021 14:07:57 +0200 Subject: [PATCH 1/2] remove dummy function --- xayn-ai-ffi-c/src/utils.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/xayn-ai-ffi-c/src/utils.rs b/xayn-ai-ffi-c/src/utils.rs index 62cb2da43..e1e701654 100644 --- a/xayn-ai-ffi-c/src/utils.rs +++ b/xayn-ai-ffi-c/src/utils.rs @@ -7,12 +7,6 @@ use xayn_ai_ffi::{CCode, Error}; #[cfg(doc)] pub use crate::slice::CBoxedSlice; -/// This function does nothing. -/// -/// Calling this prevents Swift to drop the library. -#[no_mangle] -pub extern "C" fn dummy_function() {} - /// Reads a string slice from the borrowed bytes pointer. /// /// # Errors From a675966c7f7509f8e0de79d7474c9b9c4454e73a Mon Sep 17 00:00:00 2001 From: Jan Petsche <58227040+janpetschexain@users.noreply.github.com> Date: Wed, 9 Jun 2021 14:08:13 +0200 Subject: [PATCH 2/2] use ai in swift dummy call --- bindings/dart/ios/Classes/SwiftXaynAiFfiDartPlugin.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bindings/dart/ios/Classes/SwiftXaynAiFfiDartPlugin.swift b/bindings/dart/ios/Classes/SwiftXaynAiFfiDartPlugin.swift index 459a085db..ed3cc5bba 100644 --- a/bindings/dart/ios/Classes/SwiftXaynAiFfiDartPlugin.swift +++ b/bindings/dart/ios/Classes/SwiftXaynAiFfiDartPlugin.swift @@ -14,8 +14,10 @@ public class SwiftXaynAiFfiDartPlugin: NSObject, FlutterPlugin { // The Xcode toolchain won't include the shared library in the build // process unless a method from the library is invoked. So, this - // call is just done to ensure that the library is included. + // call to a component directly related to the ai is just done to ensure + // that the library is included, independent of the actual return value + // or failure. public func enforceBinding(){ - dummy_function() + xaynai_new(nil, nil, nil, nil, nil, nil) } }