How to return byte array from Rust function to FFI C?

thanks for replay @kornel
So I can write something like this

pub fn generate_data() -> &'static [u8] {
   // returning &[u8]
}

And use it as a byte buffer pointer from C/C++ ?
If I got it right, ownership for the data passed with static lifetime would be on C/C++ for memory cleanup right?