Examples of using Dart VM and executing Dart code from C++ binaries.
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.