mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 14:07:57 +00:00
[samples/ffi] Update sqlite-tutorial
Closes: https://github.com/dart-lang/sdk/issues/51460 Change-Id: Iacf2216fcdb599267f02bd2b51287d644e7fbd33 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284361 Auto-Submit: Daco Harkes <dacoharkes@google.com> Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Slava Egorov <vegorov@google.com>
This commit is contained in:
parent
967f583e41
commit
ab876cfd5e
|
@ -212,22 +212,15 @@ In this minitutorial we used these `dart:ffi` features:
|
||||||
* Calling C functions, with `dart:ffi` automatically marshalling arguments and return value.
|
* Calling C functions, with `dart:ffi` automatically marshalling arguments and return value.
|
||||||
* Manipulating C memory through `Pointer`s with `allocate`, `free`, `load`, `store`, and `elementAt`.
|
* Manipulating C memory through `Pointer`s with `allocate`, `free`, `load`, `store`, and `elementAt`.
|
||||||
|
|
||||||
Features which we did not use in this tutorial:
|
There are many `dart:ffi` features not covered in this tutorial.
|
||||||
|
Please refer to the [API documentation](https://api.dart.dev/stable/dart-ffi/dart-ffi-library.html) for more info.
|
||||||
|
|
||||||
* `@struct` on subtypes of `Pointer` to define a struct with fields. (However, this feature is likely to change in the future.)
|
Feature which `dart:ffi` does not support:
|
||||||
|
|
||||||
Features which `dart:ffi` does not support yet:
|
* [C++ Exceptions](https://github.com/dart-lang/sdk/issues/39140) (will not be supported)
|
||||||
|
|
||||||
* Callbacks from C back into Dart.
|
It is possible to work around `dart:ffi` limitations by adding a C/C++ layer.
|
||||||
* C++ Exceptions (Not on roadmap yet.)
|
For example, we could catch C++ exceptions in a C++ layer, and rethrow them in Dart.
|
||||||
|
|
||||||
Platform limitations:
|
|
||||||
|
|
||||||
* `dart:ffi` is only enabled on 64 bit Windows, Linux, and MacOS. (Arm64 and 32 bit Intel are under review.)
|
|
||||||
* `dart:ffi` only works in JIT mode, not in AOT.
|
|
||||||
|
|
||||||
It is possible to work around some of the current limitations by adding a C/C++ layer.
|
|
||||||
For example we could catch C++ exceptions in a C++ layer, and rethrow them in Dart.
|
|
||||||
The architecture diagram would change to the following in that case.
|
The architecture diagram would change to the following in that case.
|
||||||
|
|
||||||
![architecture2](lib/scenario-full.svg)
|
![architecture2](lib/scenario-full.svg)
|
Loading…
Reference in a new issue