From 65f21119157108b1e6e4129a1cb7ab58dbecb1ea Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Tue, 8 Jan 2019 21:36:06 -0700 Subject: [PATCH 1/3] [OCaml] Use int64_t instead of int64 for OCaml versions >= 4.03.0 OCaml's int64 type was replaced with the C99 int64_t in OCaml 4.03.0. https://github.com/ocaml/ocaml/commit/b868c05ec91a7ee193010a421de768a3b1a80952 Closes #1194. --- Lib/ocaml/ocamldec.swg | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Lib/ocaml/ocamldec.swg b/Lib/ocaml/ocamldec.swg index dcc8784e1..4f705b225 100644 --- a/Lib/ocaml/ocamldec.swg +++ b/Lib/ocaml/ocamldec.swg @@ -23,6 +23,7 @@ SWIGEXT { #include #include #include +#include #define caml_array_set swig_caml_array_set @@ -101,9 +102,17 @@ SWIGEXT { #ifndef ARCH_ALIGN_INT64 +#if OCAML_VERSION >= 40300 +#define SWIG_Int64_val(v) (*((int64_t *) SWIG_Data_custom_val(v))) +#else #define SWIG_Int64_val(v) (*((int64 *) SWIG_Data_custom_val(v))) +#endif +#else +#if OCAML_VERSION >= 40300 +CAMLextern int64_t Int64_val(caml_value_t v); #else CAMLextern int64 Int64_val(caml_value_t v); +#endif #define SWIG_Int64_val(v) Int64_val(v) #endif From 48d9e3bc0204acf61c8da31ab03040515393086b Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 12 Jan 2019 13:42:29 +0000 Subject: [PATCH 2/3] Fix OCaml version detection if caml/version.h is not available Needed for OCaml versions < 4.02.0 Issue #1403 --- Lib/ocaml/ocamldec.swg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/ocaml/ocamldec.swg b/Lib/ocaml/ocamldec.swg index 4f705b225..287760eaf 100644 --- a/Lib/ocaml/ocamldec.swg +++ b/Lib/ocaml/ocamldec.swg @@ -23,7 +23,13 @@ SWIGEXT { #include #include #include + +#if defined(CAMLassert) +/* Both this macro and version.h were introduced in version 4.02.0 */ #include +#else +#define OCAML_VERSION 0 /* Unknown, but < 40200 */ +#endif #define caml_array_set swig_caml_array_set From 3075eccdd6efb56c92b6423cd256de815d76057f Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 12 Jan 2019 13:55:10 +0000 Subject: [PATCH 3/3] Add changes entry for fixing OCaml int64_t compile problem --- CHANGES.current | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.current b/CHANGES.current index bbf7a54af..75dfbecf5 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.0.0 (in progress) =========================== +2019-01-12: ZackerySpytz + [OCaml] #1403 #1194 Fix compilation problems for OCaml >= 4.03.0 due to OCaml using + int64_t instead of int64. + 2019-01-07: wsfulton #358 Add VOID to windows.i