summaryrefslogtreecommitdiff
path: root/Examples/ocaml
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-02-09 22:04:46 -0700
committerZackery Spytz <zspytz@gmail.com>2019-02-09 22:04:46 -0700
commitb2d93665fe293508f2e9970198e09c5fd8d4d949 (patch)
tree70fe9a6a469e1e5ecaf768200a6378a9be16e2fb /Examples/ocaml
parent940e32477dba502a98477960d5a0d1385f7e2edb (diff)
downloadswig-b2d93665fe293508f2e9970198e09c5fd8d4d949.tar.gz
[OCaml] Don't use argout typemaps by default for some reference types
The OCaml module's typemaps.i supplied argout typemaps for some reference types (e.g. int &) by default, which was unintuitive and inconsistent when compared with other modules. The argout_ref example depended on this, so add a typemap to argout_ref/example.i. Add multiple runtime tests that deal with references.
Diffstat (limited to 'Examples/ocaml')
-rw-r--r--Examples/ocaml/argout_ref/example.i5
1 files changed, 5 insertions, 0 deletions
diff --git a/Examples/ocaml/argout_ref/example.i b/Examples/ocaml/argout_ref/example.i
index 5ea6777fb..472a83804 100644
--- a/Examples/ocaml/argout_ref/example.i
+++ b/Examples/ocaml/argout_ref/example.i
@@ -1,6 +1,11 @@
/* File : example.i */
%module example
+%typemap(argout) (int &x, int &y) {
+ swig_result = caml_list_append(swig_result, caml_val_int(*$1));
+ swig_result = caml_list_append(swig_result, caml_val_int(*$2));
+}
+
%{
extern "C" void factor(int &x, int &y);
%}