pub unsafe trait Plugin<'ph> {
    fn init(
        ph: &mut PluginHandle<'ph>,
        filename: &str,
        arg: Option<&str>
    ) -> bool; fn deinit(&self, ph: &mut PluginHandle<'ph>) { ... } }
Expand description

A hexchat plugin.


Modern operating systems cannot deal with dynamic unloading when threads are involved, because we still haven’t figured out how to track which code address started a syscall that spawned a thread for some reason, so there’s no way for the dynamic loader to stop those threads when unloading.

Fortunately we can just shift that responsibility onto the unsuspecting Rust user. Because Rust is a safe language, this makes writing plugins inherently unsafe!

At least Unsafe Rust is still safer than writing C. So you have that going.

Required methods

Called to initialize the plugin.

Provided methods

Called to deinitialize the plugin.

This is always called immediately prior to Drop::drop.