Closed markusmoenig closed 1 year ago
btw; I still thing that making the current vm crate a library without any syscalls and an vmsdl app crate on top which provides the syscalls would be easier to maintain. But thats maybe a matter of taste.
I could implement this layout for you if you want to give it a try.
I implemented "sdl" as a default feature, to compile the vm as headless use
cargo build --no-default-features
This is required as features in rust are supposed to add features (and not remove them).
Things are a bit ugly as the #[cfg] directive can only conditionally compile ranges of code inside a function, so for example in
vm/src/sys.mod
I can do
However as I cannot do this at the top level of files, so I needed to add a lot of
#[cfg(feature = "sdl")]
to sys/window.rs (and there is no way around this).In headless mode I could compile and run the
hello_world.c
ncc example, whilesnake.c
would obviously fail with an unknown syscall.