linktime
Cross-platform libraries for link-time initialization, finalization and collection in Rust.
| crate | docs | version |
|---|---|---|
linktime |
||
ctor |
||
dtor |
||
link-section |
Crates
The linktime project comprises three crates, and the top-level linktime
crate aggregates them all.
Pick-and-choose, or import the top-level crate to get all three.
ctor
Module initialization functions for Rust (like __attribute__((constructor)) in C/C++).
Run code before main to initialize data, external resources, or other state.
[]
= { = "...", = ["ctor"] } # note: already enabled by default
# or
= "..."
use ctor; // or ctor::ctor
dtor
Module shutdown functions for Rust (like __attribute__((destructor))).
Run code after main to clean up resources, or perform other final operations.
[]
= { = "...", = ["dtor"] } # note: already enabled by default
# or
= "..."
use dtor; // or dtor::dtor
link-section
Typed and untyped link section support for Rust.
Collect related items from an entire linked binary into a single link section.
[]
= { = "...", = ["link-section"] } # note: already enabled by default
# or
= "..."
use ;
use ctor;
static FOO: ;
Contributing
Contributions are welcome!
License
These projects are dual-licensed under the Apache License, Version 2.0 and the MIT License.