Flutter 使用 rust 构建的 test.a 和 test.so 静态库,同样一个方法,在安卓模拟器上可以,在 iOS 模拟器上报 “Failed to lookup symbol: dlsym(RTLD_DEFAULT, rust_dump_file): symbol not found”
已经在 xcode 上配置了 Link Binary with Librarys 和 strip style 和 dead code stripping
if (Platform.isAndroid) {
try {
_lib = DynamicLibrary.open('test.so');
} catch (e) {
print('Error: $e');
rethrow;
}
} else if (Platform.isIOS) {
_lib = DynamicLibrary.process();
} else {
throw UnsupportedError('Unsupported platform');
}
final void Function(Pointer<Utf8>) test = _lib
.lookup<NativeFunction<Void Function(Pointer<Utf8>)>>("test")
.asFunction();
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.