A plugin is a .so against libsplinter.so, exporting sp_plugin_describe(). The layout changes so there is exactly one copy of each symbol in the process: all logic lives in libsplinter.so and both the binary and every plugin link against it. Two copies would have meant two registries. What the ABI offers: - tools with the authorization classes the loop already enforces, so the decision stays in the harness and not in the plugin; - widgets rendered in the sidebar, one line per widget (name: text); - a worker thread per widget with tick(), which may block, read files, wait on sockets - and which cannot touch curses at all; - sp_host_widget_text() as the only thread-safe write path: the host copies the string under a mutex, so a stack buffer is safe and the UI never holds a pointer a worker could free. Error paths are part of the design: a wrong ABI number is refused with both numbers in the message, a failed init is reported and skipped, a duplicate widget name is refused, a tool without a run function is not registered, and nothing is dlclose()d while a thread might be inside it. Layout: chat on three quarters, sidebar on one (session, transport, theme, last-turn numbers, widgets), status bar underneath. The clock example plugin proves the path end to end - its widget publishes 11:45:23 into the sidebar from its own thread. Seven test binaries green; test_plugin loads the real clock.so with dlopen and checks the worker actually published, plus every refusal above.
35 KiB
Executable File
35 KiB
Executable File