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();
1 iOCZS 261 天前 ![]() 静态库架构对吗? ARM 模拟器需要 ARM 静态库,另外 debug 不会对静态库进行裁剪,应该都会包含进去。 |
3 passon 261 天前 General -> Frameworks, Libraries, and Embedded Content 里面添加 .a 库了吗 |
5 suyulingxm 261 天前 编译时,没有链接上,检查一下配置。 |