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 Feb 4, 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 dartino and dartino-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 dartino binary that matches your platform:

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

Running from snapshot

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

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

Compiling to a remote VM

Normally, dartino run will launch the dartino-vm binary. But if you want to run the dartino-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/dartino-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/dartino attach tcp_socket 127.0.0.1:64745
Connecting to 127.0.0.1:64745
$ ./out/ReleaseIA32Clang/dartino run hello.dart

Other topics