Files
sdk/samples/embedder
Alexander Aprelev 3b7716ab00 [gardening] Fix embedder_samples_test leaks, uninitialized variables.
Fixes https://github.com/dart-lang/sdk/issues/59810
TEST=ci

Change-Id: I8dca122538195c8aad98e0d0fb64c7ea8e0d2e1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402421
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-12-26 12:28:38 -08:00
..

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.