Skip to content

Instantly share code, notes, and snippets.

@renatoalencar
Created December 31, 2021 01:35
Show Gist options
  • Save renatoalencar/53f1e9b289dc5f0b0c5da8e82bf5294b to your computer and use it in GitHub Desktop.
Save renatoalencar/53f1e9b289dc5f0b0c5da8e82bf5294b to your computer and use it in GitHub Desktop.
OCaml bad c object patch for windows
From ff156d75ef825155fc6877d47ff9d067fee61cca Mon Sep 17 00:00:00 2001
From: Renato Alencar <renatoalencar.73@gmail.com>
Date: Fri, 31 Dec 2021 01:19:46 +0000
Subject: [PATCH] Change tests to adapt to the new behavior
This is not ideal yet, but it gives a better idea
of what's really happening and what behavior
has broken when the previous change was introduced.
The command `ocamlopt -output-obj main_obj.o dynlink.cmxa
entry.c main.ml` is not producing an entry.o file which
is expected by the link command.
---
testsuite/tests/lib-dynlink-csharp/main.ml | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/testsuite/tests/lib-dynlink-csharp/main.ml b/testsuite/tests/lib-dynlink-csharp/main.ml
index 54798b757..c36bdf0b6 100644
--- a/testsuite/tests/lib-dynlink-csharp/main.ml
+++ b/testsuite/tests/lib-dynlink-csharp/main.ml
@@ -31,7 +31,11 @@ module = "plugin.ml"
module = ""
flags = "-output-obj"
program = "main_obj.${objext}"
-all_modules = "dynlink.cma entry.c main.ml"
+all_modules = "dynlink.cma main.ml"
+***** ocamlc.byte
+module = ""
+flags = "-c"
+all_modules = "entry.c"
****** script
script = "${mkdll} -maindll -o main.dll main_obj.${objext} entry.${objext} \
${ocamlsrcdir}/runtime/libcamlrun.${libext} ${bytecc_libs}"
@@ -67,7 +71,11 @@ all_modules = "plugin.ml"
***** ocamlopt.byte
flags = "-output-obj"
program = "main_obj.${objext}"
-all_modules = "dynlink.cmxa entry.c main.ml"
+all_modules = "dynlink.cmxa main.ml"
+***** ocamlopt.byte
+flags = "-c"
+program = "entry.${objext}"
+all_modules = "entry.c"
****** script
script = "${mkdll} -maindll -o main.dll main_obj.${objext} entry.${objext} \
${ocamlsrcdir}/runtime/libasmrun.${libext} ${nativecc_libs}"
--
2.24.1.windows.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment