-
Notifications
You must be signed in to change notification settings - Fork 68
[native_assets_cli] Access to dart_api.h and dart_api_dl.h + passing in the api version #839
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
Comments
I think that I showed you the downloadable files associated with a Python package, e.g. for tensorflow. You can see that the names are like "tensorflow-2.15.0-cp311-cp311-macosx_12_0_arm64.whl" So this is the file that will be downloaded if you install tensorflow 2.15 for Python 3.11.x on a ARM64 mac. 0.0.x version changes never break ABI compatibility but all other version changes are assumed to break ABI compatibility. There is a limited API that is guaranteed to be ABI compatible for all of Python 3.x.x (3.0 was released 15 years ago and there are still no plans for a 4.0). I'm not advocating for this, just explaining how it works ;-) I would advocate for allowing some sort of binary packaging so that users don't need a compiler to use packages containing native code. |
Yes, that is totally possible with the native assets feature. (And passing the dart_api_version would keep the precompiled capabilities on par with the on-demand-compiled capabilities when adding the path to dart_api_dl.h and friends.) |
Example showing how to use `dart_api_dl.h` in native assets. Does **not** address yet: * #839
Preventing version skew between To align the API with access to config
.code
.dart
.cApi
.headerPath
.includeDir
.version This doesn't entirely cover it properly though. We have two APIs in reality:
|
This is an embedder api intended for C code embedding the Dart VM. It's not intended to be used from native code called by Dart apps. We also reserve the right to change this API at-will. Why would we want to expose this via native assets? The whole reason for |
👍 Maybe we should consider leaning into that and making two separate include directories, so that we don't give users the wrong idea by giving them a |
From a discussion on #1937 and #93 (comment), we could solve this more nicely with a package if we can let the SDKs specify pinned versions for packages. |
@jonasfj Mentioned we have Dart SDK packages. I'll explore doing it as an SDK package:
This mandates that other packages use the dynamic linker to link against it. (Which we should have support for now: #190) |
As @mkustermann mentions above, the point of SDK-packages are mostly interesting when you want a package to ship with the SDK. So if using an older version of The only problem is if newer version of the Dart SDK stops supporting an older
|
When compiling native code from source, it would be nice if we'd compile against
dart_api.h
ordart_api_dl.h
from the Dart/Flutter SDK that is invokingbuild.dart
. This would prevent version skew between the native API and the Dart VM.It would not prevent version skew with precompiled binaries, as they already have been compiled.
To prevent version skew with precompiled binaries we'd need to pass
dart_api_version.h
's version as an argument as well, so that the users can precompile a version per Dart API. This would be analogous to what python is doing. (@brianquinlan You pointed to examples of this earlier, but I can't seem to find where you did that.) Note that at this point you'd need an older Dart SDK to precompile a dylib to an older API version.The text was updated successfully, but these errors were encountered: