Merge branch 'OCaml-caml_named_value-const'
* OCaml-caml_named_value-const:
[OCaml] Fix compilation errors with OCaml 4.09.0
diff --git a/CHANGES.current b/CHANGES.current
index 9894e25..4180d2c 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -28,6 +28,9 @@
2019-12-30: treitmayr
[Ruby] #1653 #1668 Fix code generated when using -globalmodule option.
+2019-12-29: ZackerySpytz
+ [OCaml] #1686 Fix compilation errors with OCaml 4.09.0.
+
2019-12-10: wsfulton
#1679 Fix parsing of C++11 identifiers with special meaning (final and override) when
they are used as part of the scope name of an identifier, such as a namespace name.
diff --git a/Lib/ocaml/carray.i b/Lib/ocaml/carray.i
index 5e74c3d..4378f73 100644
--- a/Lib/ocaml/carray.i
+++ b/Lib/ocaml/carray.i
@@ -77,7 +77,7 @@
%typemap(out) SWIGTYPE [] {
int i;
- CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
+ const CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
$result = caml_array_new($1_dim0);
for( i = 0; i < $1_dim0; i++ ) {
diff --git a/Lib/ocaml/ocaml.swg b/Lib/ocaml/ocaml.swg
index ac496bd..afb01da 100644
--- a/Lib/ocaml/ocaml.swg
+++ b/Lib/ocaml/ocaml.swg
@@ -62,7 +62,7 @@
#if 0
%typemap(argout) SWIGTYPE & {
- CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
+ const CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
if( fromval ) {
swig_result =
caml_list_append(swig_result,
@@ -75,7 +75,7 @@
}
}
%typemap(argout) SWIGTYPE && {
- CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
+ const CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
if( fromval ) {
swig_result =
caml_list_append(swig_result,
diff --git a/Lib/ocaml/ocamlrun.swg b/Lib/ocaml/ocamlrun.swg
index 3d552cc..5a923c5 100644
--- a/Lib/ocaml/ocamlrun.swg
+++ b/Lib/ocaml/ocamlrun.swg
@@ -407,7 +407,7 @@
CAMLreturn((long)SWIG_Int64_val(SWIG_Field(SWIG_Field(v,0),0)));
case C_enum: {
SWIG_CAMLlocal1(ret);
- CAML_VALUE *enum_to_int = caml_named_value(SWIG_MODULE "_enum_to_int");
+ const CAML_VALUE *enum_to_int = caml_named_value(SWIG_MODULE "_enum_to_int");
if( !name ) caml_failwith( "Not an enum conversion" );
ret = caml_callback2(*enum_to_int,*caml_named_value(name),v);
CAMLreturn(caml_long_val(ret));
@@ -451,7 +451,7 @@
CAMLparam1(v);
void *outptr = NULL;
swig_type_info *outdescr = NULL;
- static CAML_VALUE *func_val = NULL;
+ static const CAML_VALUE *func_val = NULL;
if( v == Val_unit ) {
*out = 0;
@@ -574,7 +574,7 @@
CAMLparam0();
SWIG_CAMLlocal1(result);
- CAML_VALUE *fromval = caml_named_value(name);
+ const CAML_VALUE *fromval = caml_named_value(name);
if (fromval) {
result = caml_callback(*fromval, caml_val_ptr(ptr, descriptor));
} else {
diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx
index 6f2a349..9f7504b 100644
--- a/Source/Modules/ocaml.cxx
+++ b/Source/Modules/ocaml.cxx
@@ -1619,7 +1619,7 @@
/* pass the method call on to the OCaml object */
Printv(w->code,
"swig_result = caml_swig_alloc(1,C_list);\n" "SWIG_Store_field(swig_result,0,args);\n" "args = swig_result;\n" "swig_result = Val_unit;\n", 0);
- Printf(w->code, "static CAML_VALUE *swig_ocaml_func_val = NULL;\n" "if (!swig_ocaml_func_val) {\n");
+ Printf(w->code, "static const CAML_VALUE *swig_ocaml_func_val = NULL;\n" "if (!swig_ocaml_func_val) {\n");
Printf(w->code, " swig_ocaml_func_val = caml_named_value(\"swig_runmethod\");\n }\n");
Printf(w->code, "swig_result = caml_callback3(*swig_ocaml_func_val,swig_get_self(),caml_copy_string(\"%s\"),args);\n", Getattr(n, "name"));
/* exception handling */