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();