Initial .gitignore
[imt.git] / link.ml
blob47a054b3df03b3d3b9cf988075b7c5d814b257f0
1 let emit_endline = ref prerr_endline
3 let process_link_output s =
4 if s <> "LINK : warning LNK4044: unrecognized option '/nologo'; ignored"
5 then
6 !emit_endline s
8 let invoke argv arg_start =
9 let is_empty s =
10 let rec loop i =
11 if i = String.length s
12 then
13 true
14 else
15 if s.[i] = ' ' || s.[i] = '\t'
16 then
17 loop (succ i)
18 else
19 false
21 loop 0
24 let _ =
25 if Utils.array_find_from
26 (fun s -> s = "/dump" || s = "-dump" || Utils.question_pred s)
27 argv arg_start
28 then
29 emit_endline := print_endline
32 let args = Utils.make_arg_string Path.check_and_modify_absolute argv arg_start in
33 let tool = Utils.tool_name "link" in
34 let command =
35 if is_empty args
36 then
37 Utils.construct_args tool "" ""
38 else
39 Utils.construct_args tool args "-nologo"
41 let ic = Unix.open_process_in command in
42 Utils.iter_crlf_chan ic process_link_output;
43 let code = Utils.close_process_in ic in
44 code