Atom

Embedding Atom

Use the script the host will evaluate

An embedding host usually passes Atom source to the VM. Start with a script you can check at the command line before adding the C setup.

Atom
print('Hello from Atom')
Output
Hello from Atom

In a host, the write callback receives this text instead of Atom writing to an assumed terminal.

Install the SDK as shown under Install the toolchain. Include atom.h. Link Atom::Static for a statically linked Atom runtime or Atom::Shared for the shared embedding library, if built. In a direct compiler invocation, link the corresponding library and all required dependencies for a static link. CMake supplies target include paths, definitions and transitive libraries. A shared deployment must make the shared library and any dependencies discoverable by the operating system at runtime.

A VM has one owning thread. Call atom_thread_attach on a host-created thread before using the API there. Release its Atom resources and call atom_thread_detach before leaving the thread. Different VMs can run on separate attached threads. To request cancellation from elsewhere use atom_interrupt, while ensuring the VM remains live. Roots keep managed values reachable from native heap data. Do not store an unrooted managed object solely in an unscanned external allocation.