---
# System prepended metadata

title: Untitled

---



```rust=
// wasm-plugin crate

extern "C" {
    fn get_u8(id: Id);
    // <snipped>
}

pub trait Plugin {
    fn game_time(&self) -> f64;
    // <snipped>
}

macro_rules! plugin_glue {
    ($ty:ty = $block:block) => {
        static PLUGIN: $ty = {
            extern "C" {
                fn game_time() {
                    unsafe { PLUGIN }.game_time()
                }
                // <snipped>
            }
            
            $block
        };
    };
}
```

```rust=
// actual plugin crate that depends on `wasm-plugin` crate

struct MyPlugin { hey: f64 }

impl wasm_plugin::Plugin for MyPlugin {
    fn game_time(&self) { self.hey + wasm_plugin::get_u8(Id::new(0)) as f64 }
}

register_plugin! {
    MyPlugin = MyPlugin { hey: 0.0 }
}
```
