Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to load .dylib in flutter app on ios platform #920

Open
santoshyadav140293 opened this issue Feb 23, 2023 · 1 comment
Open

unable to load .dylib in flutter app on ios platform #920

santoshyadav140293 opened this issue Feb 23, 2023 · 1 comment

Comments

@santoshyadav140293
Copy link

Hi,

I am working on a flutter application using an android emulator.

I have used the following dart code to load the ".dylib" file.

var libraryPath = path.join(
Directory.current.path, 'primitives_library', 'TestLibrary.dylib');

final dylib = DynamicLibrary.open(libraryPath);

but when I build the project it gives the following error.
DynamicLibrary.open error: Invalid argument(s): Failed to load dynamic library (126)

Please suggest any solution to load the ".dylib" library using an ios emulator.

Please suggest how to create a dylib library to use in the flutter app on the ios platform.

@dcharkes
Copy link
Collaborator

The dylibs need to be compiled to different target architectures and OSes.
And they need to be bundled the right way in Flutter.

If you have C/C++ source code, then please take a look at flutter create --template=plugin_ffi --platform=android,ios <name>.
If you have precompiled libraries, then you need to modify the Gradle/CocoaPods/CMake files generated in the plugin_ffi template.

Currently packages cannot be Dart standalone and work for Flutter. dart-lang/sdk#50565 tracks our effort to solve this.

@dcharkes dcharkes transferred this issue from dart-archive/ffi Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants