summaryrefslogtreecommitdiff
path: root/Lib/ocaml
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-01-08 21:36:06 -0700
committerZackery Spytz <zspytz@gmail.com>2019-01-08 21:36:06 -0700
commit65f21119157108b1e6e4129a1cb7ab58dbecb1ea (patch)
treeca47f54c75a72f1fa89d1d85783c97b3562cc7eb /Lib/ocaml
parent4e4bb54fe7f01432825a1e0bcc1ffde7bd822271 (diff)
downloadswig-65f21119157108b1e6e4129a1cb7ab58dbecb1ea.tar.gz
[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.
Diffstat (limited to 'Lib/ocaml')
-rw-r--r--Lib/ocaml/ocamldec.swg9
1 files changed, 9 insertions, 0 deletions
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 <caml/callback.h>
#include <caml/fail.h>
#include <caml/misc.h>
+#include <caml/version.h>
#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