53ba9af361
For now we use a static library, but I am planning to add support for a shared library in a follow-up CL. Tested: locally on macOS and Linux, also ci should at least build samples. Change-Id: I277239359de226c56633884f350b22a030759ab6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392640 Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
834 B
834 B
Dart VM Embedding examples
Examples of using Dart VM and executing Dart code from C++ binaries.
run_kernel.cc
To run the example:
./tools/build.py --no-rbe --mode=release samples/embedder:run_kernel && out/ReleaseX64/run_kernel
The example initializes Dart VM, creates an isolate from a kernel file (by
default it uses kernel-compiled hello.dart), launches its main function with
args and exits.
You can also compile your own Dart kernel like this:
dart compile kernel --no-link-platform my.dart
out/ReleaseX64/run_kernel my.dill
Since the kernel file format is unstable, the dart binary needs to be of a
matching version. The simplest way to ensure this is to build Dart SDK from the
same checkout, see
Building Dart SDK.