Writing native plugins

Implement %native classes in C: declare them in .loth, implement them in a shared library, and let the VM bind and validate the two.

What you need

The running example

The track builds one plugin: a stateful Counter class plus a CounterUtil singleton registered by the same library.

value=30 label=hits twice=42
divide: DivideByZeroException

The example exercises every mechanism the chapters describe: language-visible fields, a GC root held in the handle, a language exception thrown from C, a blocking call, and a two-class library.

Chapters