Since none of the similar topics managed to get any answer and all related topics have disabled answers I decided to share it what was my solution for that problem.
#[no_mangle]
pub extern "C" fn look_at_me2() -> usize {
42
}
fn main(){
println!("Hello");
}
The following code can be compiled with export-executable-symbol flag (docs export_executable_symbols - The Rust Unstable Book). This flag was available only with nightly version.
To bump to rust nightly, you can run:
rustup default nightly
To use export-executable-symbol you can run:
cargo rustc --bin engine -- -Z export-executable-symbols
If there is any other way to accomplish that without installing nightly version, feel free to join discussion!