#[macro_use]
extern crate lazy_static;
extern crate monster;
use monster::incubation::global_init_cleanup::*;
lazy_static! {
static ref INIT_HANDLE: GlobalInitHandle<MyLib> = InitHandle::new_global();
}
struct MyLib {
init_handle: LocalInitHandle<MyLib>
}
impl MyLib {
fn new() -> MyLib {
MyLib {
init_handle: InitHandle::from_global(&INIT_HANDLE)
}
}
}
impl InitCleanup for MyLib {
fn init() { println!("LIB_INIT()"); }
fn cleanup() { println!("LIB_CLEANUP()"); }
}
fn main() {
let l1 = MyLib::new();
let l2 = MyLib::new();
let l3 = MyLib::new();
}