Skip to content

Commit 7cf0cfa

Browse files
committed
Fix linking issue.
1 parent eee2829 commit 7cf0cfa

4 files changed

Lines changed: 18 additions & 20 deletions

File tree

driver/compenv.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ let c_object_of_filename name =
553553
Filename.chop_suffix (Filename.basename name) ".c" ^ Config.ext_obj
554554

555555
let process_action
556-
(ppf, implementation, interface, ocaml_mod_ext, ocaml_lib_ext) action =
556+
(ppf, implementation, interface, ocaml_mod_ext, ocaml_lib_ext, usage) action =
557557
match action with
558558
| ProcessImplementation name ->
559559
readenv ppf (Before_compile name);
@@ -585,9 +585,10 @@ let process_action
585585
ccobjs := name :: !ccobjs
586586
else if not !native_code && Filename.check_suffix name Config.ext_dll then
587587
dllibs := name :: !dllibs
588-
else
589-
raise(Arg.Bad("don't know what to do with " ^ name))
590-
588+
else begin
589+
prerr_endline ("don't know what to do with " ^ name);
590+
prerr_string usage
591+
end
591592

592593
let action_of_file name =
593594
if Filename.check_suffix name ".ml"

driver/compenv.mli

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,6 @@ val process_deferred_actions :
7474
(Format.formatter -> string -> string -> unit) * (* compile implementation *)
7575
(Format.formatter -> string -> string -> unit) * (* compile interface *)
7676
string * (* ocaml module extension *)
77-
string -> (* ocaml library extension *)
77+
string * (* ocaml library extension *)
78+
string -> (* usage string for error message*)
7879
unit

driver/main.ml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,14 @@ let main () =
129129
try
130130
readenv ppf Before_args;
131131
Arg.parse_expand Options.list anonymous usage;
132-
try
132+
let usage = Arg.usage_string Options.list usage in
133133
Compenv.process_deferred_actions
134134
(ppf,
135135
Compile.implementation,
136136
Compile.interface,
137137
".cmo",
138-
".cma");
139-
with Arg.Bad msg ->
140-
prerr_endline msg;
141-
Arg.usage Options.list usage;
138+
".cma",
139+
usage);
142140
readenv ppf Before_link;
143141
if
144142
List.length (List.filter (fun x -> !x)

driver/optmain.ml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,14 @@ let main () =
240240
Arg.parse_expand spec anonymous usage;
241241
if !gprofile && not Config.profiling then
242242
fatal "Profiling with \"gprof\" is not supported on this platform.";
243-
try
244-
Compenv.process_deferred_actions
245-
(ppf,
246-
Optcompile.implementation ~backend,
247-
Optcompile.interface,
248-
".cmx",
249-
".cmxa");
250-
with Arg.Bad msg ->
251-
prerr_endline msg;
252-
Arg.usage spec usage;
243+
let usage = Arg.usage_string spec usage in
244+
Compenv.process_deferred_actions
245+
(ppf,
246+
Optcompile.implementation ~backend,
247+
Optcompile.interface,
248+
".cmx",
249+
".cmxa",
250+
usage);
253251
readenv ppf Before_link;
254252
if
255253
List.length (List.filter (fun x -> !x)

0 commit comments

Comments
 (0)