{"action":"created","issue":{"url":"https://api.github.com/repos/ocaml/ocamlbuild/issues/106","repository_url":"https://api.github.com/repos/ocaml/ocamlbuild","labels_url":"https://api.github.com/repos/ocaml/ocamlbuild/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/ocaml/ocamlbuild/issues/106/comments","events_url":"https://api.github.com/repos/ocaml/ocamlbuild/issues/106/events","html_url":"https://github.com/ocaml/ocamlbuild/issues/106","id":172344580,"number":106,"title":"When compiling a program with two .cmo/.cmx, how to order them ?","user":{"login":"gildor478","id":452797,"avatar_url":"https://avatars2.githubusercontent.com/u/452797?v=3","gravatar_id":"","url":"https://api.github.com/users/gildor478","html_url":"https://github.com/gildor478","followers_url":"https://api.github.com/users/gildor478/followers","following_url":"https://api.github.com/users/gildor478/following{/other_user}","gists_url":"https://api.github.com/users/gildor478/gists{/gist_id}","starred_url":"https://api.github.com/users/gildor478/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gildor478/subscriptions","organizations_url":"https://api.github.com/users/gildor478/orgs","repos_url":"https://api.github.com/users/gildor478/repos","events_url":"https://api.github.com/users/gildor478/events{/privacy}","received_events_url":"https://api.github.com/users/gildor478/received_events","type":"User","site_admin":false},"labels":[{"id":294910538,"url":"https://api.github.com/repos/ocaml/ocamlbuild/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-21T22:16:32Z","updated_at":"2017-03-01T21:49:35Z","closed_at":null,"body":"(context: working on OASIS support for objects)\n\nI have 3 files:\nL.ml, content = 'let r = ref \"a\"'\nO.ml, content = 'let () = L.r := \"b\"'\nmain.ml, content = 'let () = print_endline !L.r'\n\nL.ml compiles to a library 'lib'\nO.ml compile to an object 'obj'\nmain.ml depends on lib and obj and should compile to main.byte\n\nWhat I want is that O.cmo is before main.cmo on command line so that L.r will get the value \"b\"/\n\nWhat I get is that O.cmo is after main.cmo.\n\nSo far, I did that:\n\nmyocamlbuild.ml:\n| After_rules ->\n  dep [\"link\"; \"ocaml\"; \"byte\"; \"use_obj_obj\"]  [\"O.cmo\"] \n\n_tags:\n\"main.byte\": use_lib\n\"main.byte\": use_obj_obj\n\nHere is the output for 'ocamlbuild -verbose 10 main.byte':\n\nL.cmo already built\nnew dyndep for \"ocaml: mllib & cmo\\* -> cma (%=lib )\"([ lib.cma ]): \"L.cmo\"\ncaml_transitive_closure ~caml_obj_ext:\"cmo\" ~pack_mode:true\n  ~used_libraries:[  ] [ \"L.cmo\" ]\npackages: {.  .}\ndependency_map: {: \"O.cmo\" => {. L.cmo .}; \"main.cmo\" => {. L.cmo .};:}\nused_files: {. L.cmo .}\nopen_packages: [  ]\nlib_index: {::}\ndependencies: {: \"O.cmo\" => {. L.cmo .}; \"main.cmo\" => {. L.cmo .};:}\ncaml_transitive_closure: [ \"L.cmo\" ] -> [ \"L.cmo\" ]\ndyndeps: {. L.cmo .}\nmid rule ocaml: mllib & cmo\\* -> cma (%=lib ): cache hit\n[cache hit] ocamlfind ocamlc -a L.cmo -o lib.cma\nend rule ocaml: mllib & cmo\\* -> cma (%=lib )\nnew dyndep for \"ocaml: cmo\\* -> byte (%=main )\"([ main.byte ]): \"lib.cma\"\ncaml_transitive_closure ~caml_obj_ext:\"cmo\" ~pack_mode:false\n  ~used_libraries:[ \"lib.cma\" ] [ \"main.cmo\"; \"O.cmo\" ]\npackages: {.  .}\ndependency_map:\n  {:  \n      \"O.cmo\" => {. L.cmo .};\n      \"lib.cma\" => {. L.cmo .};\n      \"main.cmo\" => {. L.cmo .};\n  :}\nused_files: {. L.cmo, O.cmo, main.cmo .}\nopen_packages: [  ]\nlib_index: {: \"L.cmo\" => [ \"lib.cma\" ];:}\ndependencies: {: \"O.cmo\" => {. lib.cma .}; \"main.cmo\" => {. lib.cma .};:}\ncaml_transitive_closure: [ \"main.cmo\"; \"O.cmo\" ] ->\n  [ \"O.cmo\"; \"main.cmo\"; \"lib.cma\" ]\nlink: [ \"lib.cma\"; \"main.cmo\"; \"O.cmo\" ] -o main.byte\n====> O.cmo\nO.cmo already built\nnew dyndep for \"ocaml: cmo\\* -> byte (%=main )\"([ main.byte ]): \"O.cmo\"\ndyndeps: {. L.cmo, O.cmo, lib.cma .}\nmid rule ocaml: cmo\\* -> byte (%=main ): cache miss: a product is not in build dir (main.byte)\n/home/gildor/.opam/4.03.0/bin/ocamlfind ocamlc -linkpkg lib.cma main.cmo O.cmo -o main.byte\nresource_changed: main.byte\nend rule ocaml: cmo\\* -> byte (%=main )\n\nIs there a way to define the order of O.cmo and main.cmo ?\n"},"comment":{"url":"https://api.github.com/repos/ocaml/ocamlbuild/issues/comments/283481714","html_url":"https://github.com/ocaml/ocamlbuild/issues/106#issuecomment-283481714","issue_url":"https://api.github.com/repos/ocaml/ocamlbuild/issues/106","id":283481714,"user":{"login":"whitequark","id":54771,"avatar_url":"https://avatars2.githubusercontent.com/u/54771?v=3","gravatar_id":"","url":"https://api.github.com/users/whitequark","html_url":"https://github.com/whitequark","followers_url":"https://api.github.com/users/whitequark/followers","following_url":"https://api.github.com/users/whitequark/following{/other_user}","gists_url":"https://api.github.com/users/whitequark/gists{/gist_id}","starred_url":"https://api.github.com/users/whitequark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whitequark/subscriptions","organizations_url":"https://api.github.com/users/whitequark/orgs","repos_url":"https://api.github.com/users/whitequark/repos","events_url":"https://api.github.com/users/whitequark/events{/privacy}","received_events_url":"https://api.github.com/users/whitequark/received_events","type":"User","site_admin":false},"created_at":"2017-03-01T21:49:35Z","updated_at":"2017-03-01T21:49:35Z","body":"The question was answered, closing."}}
{"actor":{"display_login":"whitequark"}}