Unsafe, FFI, and C
unsafe is a module-level choice: you opt a file into raw pointers and foreign calls, not a single expression. Keep those files small.
unsafe
extern c {
fn puts(s: *i8) -> i32
}
fn main() {
puts("hello from C")
}
What unsafe allows
- Raw pointers and integer-to-pointer casts
extern cagainst libc, Win32, a board SDK- MMIO as
volatileloads/stores through a mapped address
What it does not excuse
You still own the aliasing story. A C function that retains a pointer after you drop the buffer is still a bug: now it is your bug, documented next to the extern block.
Why this is the electronics path
Firmware and drivers already speak C ABIs. Buraaq does not invent a second calling convention. You wrap the SDK once, then write the rest of the crate in safe Buraaq: lists, loops, throws, drop.
Next: electronics | firmware | drivers
