diff --git a/Makefile b/Makefile index 28f5537..d6a7d44 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,8 @@ BUILD:=_build # dune build src/core/oboy.exe core: - dune build src/core/oboy.so - cp _build/default/src/core/oboy.so $(BUILD)/liboboycore.so + dune build src/core/cbindings.exe.o + ar -rs $(BUILD)/liboboycore.a _build/default/src/core/cbindings.exe.o # check: # ocamlbuild -use-ocamlfind -I src -lflag -g test/test_bit.byte -- diff --git a/src/core/cbindings.ml b/src/core/cbindings.ml new file mode 100644 index 0000000..39363db --- /dev/null +++ b/src/core/cbindings.ml @@ -0,0 +1,3 @@ +let () = + Callback.register "name" Version.name; + Callback.register "version" Version.version; diff --git a/src/core/dune b/src/core/dune index 2226067..f5c530a 100644 --- a/src/core/dune +++ b/src/core/dune @@ -1,7 +1,12 @@ -; oboy.ml as the top-level file +; cbindings.ml as the top-level file ; building a shared library because we are relying on pthread and we cannot ; combine static pthread with dynamic libc (executable - (name oboy) - (libraries threads) - (modes shared_object)) + (name cbindings) + (modes object)) + +; Standalone binary +; TODO: split with core module +;(executable +; (name main.ml) +; (libraries threads)) diff --git a/src/core/oboy.ml b/src/core/main.ml similarity index 93% rename from src/core/oboy.ml rename to src/core/main.ml index 6fd7568..521cf16 100644 --- a/src/core/oboy.ml +++ b/src/core/main.ml @@ -60,7 +60,7 @@ let power_up cartridge = run cpu mem screen -(** let main = +let () = if Array.length Sys.argv < 2 then begin prerr_endline "Please specify a ROM."; eprintf "Usage: %s path/to/rom\n" Sys.argv.(0); @@ -70,8 +70,4 @@ let power_up cartridge = let cartridge = Cartridge.read_cartridge Sys.argv.(1) in match cartridge with | None -> print_endline "Invalid ROM file." - | Some c -> power_up c *) - -let () = - Callback.register "name" Version.name; - Callback.register "version" Version.version; + | Some c -> power_up c