ctor 0.12.0

__attribute__((constructor)) for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use ctor::ctor;

#[ctor(anonymous)]
unsafe fn foo() {
    println!("Hello, world!");
}

#[ctor]
unsafe fn bar() {
    println!("Hello, world!");
}

fn main() {
    // Disallowed
    foo();
    // Allowed
    bar();
}