How can I access a C global variable/constant in Rust FFI?

Viewed 3640

I need to access a value of a constant exported from C in Rust.

I want to read the value from the actual symbol, and not just copy'n'paste the value to Rust (in my case the value is a pointer, and C checks for pointer equality).

extern void *magic;

What's the syntax to get magic: *const c_void readable in Rust?

1 Answers
Related