Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug)]
- struct PluginFfi;
- static mut THIS_PLUGIN: Option<Box<PluginFfi>> = None;
- #[no_mangle]
- fn plugin_init() {
- unsafe {
- THIS_PLUGIN = Some(Box::new(PluginFfi));
- }
- }
- #[no_mangle]
- fn plugin_end() {
- unsafe {
- THIS_PLUGIN = None;
- }
- }
- impl Drop for PluginFfi {
- fn drop(&mut self) {
- println!("{:?} dropped", self);
- }
- }
- fn main() {
- plugin_init();
- plugin_end();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement