tree: 5598021f6516eba900d0025907b10d5c6410cf8c [path history] [tgz]
  1. BUILD.gn
  2. hello.dart
  3. README.md
  4. run_kernel.cc
samples/embedder/README.md

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.