Skip to content

Commit

Permalink
Allow -l option to ocamlmklib on MSVC ports
Browse files Browse the repository at this point in the history
In general (especially for the Windows API), -lfoo cannot be used to
link libraries because the various drivers assume that libfoo.lib is
meant. This patch allows ocamlmklib to mask this difference so that
-luser32 will refer to libuser32.a as normal on MinGW but user32.lib on
MSVC.
  • Loading branch information
dra27 committed Jun 4, 2017
1 parent 4664787 commit 44244d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Changes
Expand Up @@ -82,6 +82,9 @@ Working version
attribute is hidden by signature coercion
(Alain Frisch, report by bmillwood, review by Leo White)

- GPR#1189: allow MSVC ports to use -l option in ocamlmklib
(David Allsopp)

### Manual and documentation:

- PR#6548: remove obsolete limitation in the description of private
Expand Down
6 changes: 6 additions & 0 deletions tools/ocamlmklib.ml
Expand Up @@ -101,6 +101,12 @@ let parse_arguments argv =
else if s = "-linkall" then
caml_opts := s :: !caml_opts
else if starts_with s "-l" then
let s =
if Config.ccomp_type = "msvc" then
String.sub s 2 (String.length s - 2) ^ ".lib"
else
s
in
c_libs := s :: !c_libs
else if starts_with s "-L" then
(c_Lopts := s :: !c_Lopts;
Expand Down

0 comments on commit 44244d4

Please sign in to comment.