#plugin #irc #chat #api-bindings #memory-leaks #xchat

nightly hexchat

A safe API for creating HexChat plugins

12 releases

0.6.3 Mar 2, 2020
0.6.2 Feb 28, 2019
0.5.0 Feb 28, 2019
0.4.0 Feb 26, 2019
0.1.3 Feb 20, 2019

#15 in #memory-leaks

MIT license

175KB
4.5K SLoC

hexchat-rs

A safe API for creating HexChat plugins.

To get started, create a struct representing your plugin, and implement Plugin for it. Then, call plugin! on the struct.

All plugins should be built as cdylibs, or if for some reason you have no other choice, dylibs. Do not attempt to define a main() symbol; Plugin::new is your plugin's 'entry point'. For that matter, do not attempt to define the HexChat C docs' described extern fns - this is taken care of for you by the plugin! macro.

If window manipulation is desired, then the window feature should be enabled.

Static variables holding heap resources are discouraged and will cause memory leaks. This crate provides a safe_static! macro for this purpose. Please note that any thread that you create that accesses a safe static must be killed in your plugin's Drop implementation, and it's undefined not to. You should kill them anyway even if you don't use this, because they'll be a memory leak too otherwise.

Dependencies

~4–7MB
~155K SLoC