Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.
Michael Thomsen edited this page Jan 27, 2016 · 16 revisions

Practicalities

Once you're done Building the Dartino binaries, you can run your Dartino code in two ways: (1) from source and (2) from snapshot. In the following examples, we assume that you are running on a 32-bit Linux system. You'll have to adjust the path to the fletch and fletch-vm binaries on other platforms.

Running from source

This is the easiest way of running Dart code on top of Dartino. You simply pass the .dart file to run to the fletch binary that matches your platform:

$ out/ReleaseIA32Clang/fletch run hello.dart
Hello, World!

Running from snapshot

Running from a snapshot is also simple. You just instruct fletch to output a snapshot and then you run it separately with the raw fletch-vm binary:

$ out/ReleaseIA32Clang/fletch export hello.dart to hello.snapshot
$ out/ReleaseIA32Clang/fletch-vm hello.snapshot
Hello, World!

Compiling to a remote VM

Normally, fletch run will launch the fletch-vm binary. But if you want to run the fletch-vm on a device (a phone, tablet, smart lightbulb, etc.) it is often easier to start the VM and tell the compiler to attach to the already running VM. For example, on the device, run:

$ ./out/ReleaseIA32Clang/fletch-vm
Waiting for compiler on 127.0.0.1:64745

Then forward a port from your laptop to port 64745 on the device, for example, using ssh from the laptop:

$ ssh -L 64745:127.0.0.1:64745 hostname-of-device

Finally, on the laptop, run the compiler:

$ ./out/ReleaseIA32Clang/fletch attach tcp_socket 127.0.0.1:64745
Connecting to 127.0.0.1:64745
$ ./out/ReleaseIA32Clang/fletch run hello.dart

Other topics