Create an .exe that exports symbols - solution

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!

2 Likes

Please use text for the code so that everyone (including those using screen readers) can read it.

Thanks, edited and fixed.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.