Macro aya::include_bytes_aligned
source · [−]macro_rules! include_bytes_aligned {
($path:expr) => { ... };
}
Expand description
Include bytes from a file for use in a subsequent crate::Bpf::load
.
This macro differs from the standard include_bytes!
macro since it also ensures that
the bytes are correctly aligned to be parsed as an ELF binary. This avoid some nasty
compilation errors when the resulting byte array is not the correct alignment.
Examples
ⓘ
use aya::{Bpf, include_bytes_aligned};
let mut bpf = Bpf::load(include_bytes_aligned!(
"/path/to/bpf.o"
))?;