1 unstable release
0.1.0 | Oct 13, 2023 |
---|
#26 in #symbol-table
6KB
67 lines
rsymtab
bla
lib.rs
:
this is a crate for generating a list of exported symbols, similar to how the ksymtab
works in the linux kernel, but for
rust crates.
the basic idea is that you can export items by adding an #[export]
attribute on them, and then you can access
all the exported symbols by calling the symbols
function.
Example
fn main() {
println!("{:?}", rsymtab::symbols());
}
#[rsymtab::export]
fn foo() {}
#[rsymtab::export]
fn bar() {}
#[rsymtab::export]
static mut FOO: u32 = 5;
Portability
NOTE: this crate currently only works on linux.
that is because it uses a linker script to achieve some of the magic of creating the symbol table. additionally, only linkers which support specification of multiple linker scripts are supported, because otherwise this crate will overwrite the default linker script.
Dependencies
~240–690KB
~16K SLoC