Skip to content

Instantly share code, notes, and snippets.

@heavyrain266
Created September 16, 2022 17:16
Show Gist options
  • Save heavyrain266/824593ae4a961f1c1cf712e1cfc1ffb7 to your computer and use it in GitHub Desktop.
Save heavyrain266/824593ae4a961f1c1cf712e1cfc1ffb7 to your computer and use it in GitHub Desktop.
Reference for running rust on consoles
// rust.h
extern void rust_main();
// main.c
#import "rust.h"
void main()
{
rust_main();
}
use bevy::prelude::*;
fn main() {
App::new()
.add_system(hello_world_system)
.run();
}
fn hello_world_system() {
println!("hello world");
}
#[no_mangle]
extern "C" fn rust_main() {
main();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment