-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Update description of Static vs Dynamic LIbraries on 'Binding to native code using dart:ffi' pages #5334
Comments
Thoughts, @mit-mit? |
Yes, I agree that this page would benefit from some elaboration. cc @dcharkes |
Similar issue flutter/flutter#75537.
We have not explored the non-documented ways. They might be possible. If they are, PRs are welcome to update the documentation. We should update the page to reflect this. @sfshaza2 @mit-mit any suggestions for wording? |
@chinmaygarde, do you have any insight into what we could say about this distinction? |
There is no magic in the way symbol resolution works for Dart FFI. The symbols need to be resolved from a library using In Dart code, The specific guidance for iOS and Android differs because of the way the applications are packaged. On iOS, there is an executable that needs to be built already and it is generally easier to link static libraries into this executable. Once in the executable, Now, on Android, there no executable generated (the thing that contains the Hope this helps clarify things. |
Wow, @chinmaygarde, thanks for that detailed answer! |
Ah that makes sense. Although isn't Flutter AoT compiled now on Android? Does that not give a binary you can statically link into? I guess maybe it's just too much of a pain to do, and it wouldn't work with hot reload which would kind of suck. |
Right, it would be limited to specific modes. Also, the default Flutter workflow for Android doesn't require a native toolchain. So everyone would have to download the NDK or some other toolchain and have that versioned and updated. The assumption is that if you are writing native code, you already have a build system and toolchain in place for it that can generate a dynamic library. |
Page URLs
Page source
https://github.com/flutter/website/tree/master/src/docs/development/platform-integration/c-interop.md
Description of issue
The introduction isn't very clear about static vs dynamic linking. It explains what they are - fine, I expect most people reading it already know - but then it just jumps into dynamic linking on Android and static linking on iOS with no explanation as to why.
I presume that dynamic linking is forbidden on iOS and static linking doesn't work on Android? Or something like that? I would be good to explain that.
The text was updated successfully, but these errors were encountered: