Trying to write wireshark plugin in rust. First step wireshark does is checking if plugin version is compatible. Unfortunately it does it not by calling a function but by checking exported
*char plugin_release. I managed to export functions but can not figure out how to do a string.
This export symbol but content is wrong, because it is pointer to slice and not C string.
#[no_mangle] #[used] pub static plugin_release : &[u8;6] = b"2.6\0";
And this should give me what I want but it does not compile:
#[no_mangle] #[used] pub static plugin_release: *const u8 = "2.6\0".as_ptr();
error[E0277]: `*const u8` cannot be shared between threads safely --> src/lib.rs:23:1 | 23 | pub static plugin_release: *const u8 = "2.6\0".as_ptr(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const u8` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `*const u8` = note: shared static variables must have a type that implements `Sync`
Is there a way to implement it in Rust? Maybe I can have small C code and link obj file with the result .so? Anything Cargo can help with?