-
Notifications
You must be signed in to change notification settings - Fork 50
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
Using dart:ffi with a xcframework containing static binaries (iOS) #934
Comments
Static libraries are not currently supported.
For static libraries to work, either the Dart code itself would need to be compiled to a static library and then the two static libraries would need to be linked together with the native linker (tracked in dart-lang/sdk#49418), or the static library would need to be compiled into a dynamic library specifying the list of symbols that should be visible for lookup. The latter option becomes useful if we could automate that based on which |
@dcharkes Thanks for the response. |
Yes, if you invoke the linker with the right flags. But why do you have a static library in the first place? Can't you get a dynamic library instead? (Static libraries are usually not stable as a distribution format.) Can you elaborate on your use case?
I don't know the answer to this. |
@dcharkes Yeah ;( its closed third party software they only provide a static lib currently (I requested a dynamic one but pending) I want to include the static libs into an ios version of a flutter plugin following this (see iOS section) to bind to the lib but i run into symbol not found error. If i understand you right, first the static lib has to be compiled to a dynamic one using something like this after that i redo the steps from the first article using the new dynamic lib. |
When trying the steps you mentioned here i run into many Steps:
s.vendored_frameworks = 'Frameworks/libcool.xcframework'
s.pod_target_xcconfig = { "OTHER_LDFLAGS" => "-all_load -ObjC" } |
Hello, anything new? |
This issue is about static libraries, not dynamic libraries. Please file a new issue. |
@jtdLab I got duplicate symbols
|
Given the
libcool.xcframework
containing large static binaries like so:and a
bindings.dart
containing the bindings generated with ffigen.What is the recommended way to use this in my iOS FFI Plugin.
My plugins
podspec
looks like this:When opening the dynamic library of the plugin in dart with
DynamicLibrary.open('my_plugin.framework/my_plugin')
and calling one of the bindings i run into
Invalid argument(s): Failed to lookup symbol '<lib_cool_method_a>': dlsym(0x7f97b7a3ecb0, lib_cool_method_a): symbol not found
The text was updated successfully, but these errors were encountered: