Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #[derive(Debug)]
  2. struct PluginFfi;
  3.  
  4. static mut THIS_PLUGIN: Option<Box<PluginFfi>> = None;
  5.  
  6. #[no_mangle]
  7. fn plugin_init() {
  8. unsafe {
  9. THIS_PLUGIN = Some(Box::new(PluginFfi));
  10. }
  11. }
  12.  
  13. #[no_mangle]
  14. fn plugin_end() {
  15. unsafe {
  16. THIS_PLUGIN = None;
  17. }
  18. }
  19.  
  20. impl Drop for PluginFfi {
  21. fn drop(&mut self) {
  22. println!("{:?} dropped", self);
  23. }
  24. }
  25.  
  26. fn main() {
  27. plugin_init();
  28. plugin_end();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement