diff --git a/CHANGES.current b/CHANGES.current index 6ba34a90a..b9363f7d8 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-11: ZackerySpytz [OCaml] #1400 Fix getters and setters. diff --git a/Lib/ocaml/ocamldec.swg b/Lib/ocaml/ocamldec.swg index dcc8784e1..287760eaf 100644 --- a/Lib/ocaml/ocamldec.swg +++ b/Lib/ocaml/ocamldec.swg @@ -24,6 +24,13 @@ SWIGEXT { #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 // Adapted from memory.h and mlvalues.h @@ -101,9 +108,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