[m-rev.] diff: fix archive creation with mmc --make and MSVC

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Sep 19 01:13:09 AEST 2011


Branches: 11.07, main

Fix another problem with mmc --make and MSVC.
(This is the first issue listed in bug #99.)

compiler/compile_target_code.m:
 	Archive creation was not working with MSVC and mmc --make
 	because the Mercury compiler was inserting a space between
 	the -OUT: option and its argument.

Julien.

Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.174
diff -u -r1.174 compile_target_code.m
--- compiler/compile_target_code.m	15 Sep 2011 16:14:34 -0000	1.174
+++ compiler/compile_target_code.m	18 Sep 2011 15:05:23 -0000
@@ -2598,9 +2598,31 @@
          join_string_list(ObjectList, "", "", " ", Objects)
      ),

+    % NOTE: when using the Windows Library Manager Tool (lib) there must
+    % _not_ be a space between the -OUT: option and its argument.
+    % XXX we actually check the C compiler type here since that is more
+    % robust than using the values of the configuration options used for
+    % archive creation.
+    get_c_compiler_type(Globals, C_CompilerType),
+    (
+        % If we are using Visual C then we must be using the Microsoft
+        % lib tool.
+        C_CompilerType = cc_cl(_),
+        ArOutputSpace = ""
+    ;
+        ( C_CompilerType = cc_gcc(_, _, _)
+        ; C_CompilerType = cc_clang(_)
+        ; C_CompilerType = cc_lcc
+        ; C_CompilerType = cc_unknown
+        ),
+        ArOutputSpace = " "
+    ),
+
      MakeLibCmdArgs = string.append_list([
-        ArFlags, " ", ArOutputFlag, " ",
-        LibFileName, " ", Objects]),
+        ArFlags, " ",
+        ArOutputFlag, ArOutputSpace, LibFileName, " ",
+        Objects]
+    ),

      invoke_long_system_command(Globals, ErrorStream, cmd_verbose_commands,
          ArCmd, MakeLibCmdArgs, MakeLibCmdSucceeded, !IO),

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list