From 24b77b1c7465fe12a888e7aec67fd5861cea37e3 Mon Sep 17 00:00:00 2001 From: Matthieu Dubuget Date: Sun, 14 Apr 2019 07:17:46 +0200 Subject: [PATCH] Explanation See https://discuss.ocaml.org/t/problem-to-compile-a-dll-on-mingw/3661/2 for the short explanation. More in depth discussions: - the patch that explain why the behaviour changed: https://github.com/ocaml/ocaml/pull/1535 - a discussion which allow to understand the problem: https://github.com/ocaml/ocaml/issues/6411 I had two choices: - either use `eval $(ocaml-env cygwin)` - or add a `-link -static-libgcc` at link time The first solution works "for me": the PATH environment variable is modified on my computer, and things are working fine. But since my goal is to distribute the DLL to others, who do not necessarily have cygwin installed, I chose the second solution. --- dll/dune | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dll/dune b/dll/dune index b9f5815..39822e8 100755 --- a/dll/dune +++ b/dll/dune @@ -1,7 +1,9 @@ (executable (name tst) (libraries tst_stub) - (modes shared_object)) + (modes shared_object) + (link_flags :standard -cclib -link -cclib -static-libgcc) +) (alias (name install)