4 ms·
Rust has `#[link_section]`, `#[export_name]`, and `include_bytes!()`, which together allow you to put data from a file under specific symbol in a specific secti
by zokier 3y ago
Rust has `#[link_section]`, `#[export_name]`, and `include_bytes!()`, which together allow you to put data from a file under specific symbol in a specific section. Maybe not applicable to the problem in tfa but seems to accomplish all that incbin does too.
- trealira 3y agoAlso, C23 has #embed included as a preprocessor directive. It serves similar purpose to include_bytes!(), although I don't think there's a way to specify the section it goes in within the executable. https://thephd.dev/finally-embed-in-c23 https://thephd.dev/finally-embed-in-c23
- saagarjha 3y agoI haven't used #embed yet personally, but if it gives you an array or similar back then you should be able to apply attributes to the variable to tell the compiler where to store it?
- trealira 3y agoI know GCC has section attributes, but I don't think there's any standard C23 attribute equivalent.