summaryrefslogtreecommitdiff
path: root/Lib/ocaml/typemaps.i
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-01-29 09:18:30 -0700
committerZackery Spytz <zspytz@gmail.com>2019-01-29 09:18:30 -0700
commit85860c0a61c3be2a032a9fc935dffff66586f2a9 (patch)
treee9ea27b2a7f14609231900b70708417c71f42069 /Lib/ocaml/typemaps.i
parent7118e4ef1ef3ab9e4ccdf9273785480be8fd7905 (diff)
downloadswig-85860c0a61c3be2a032a9fc935dffff66586f2a9.tar.gz
[OCaml] Fix the char_binary test for OCaml
Add %typemap(in) (char *STRING, size_t LENGTH). Fix warnings in char_binary.i. ./../char_binary.i:7: Warning 453: Can't apply (char *STRING,size_t LENGTH). No typemaps are defined. ./../char_binary.i:8: Warning 453: Can't apply (char *STRING,size_t LENGTH). No typemaps are defined. Add a runtime test (it is based on the Python and Go char_binary runtime tests).
Diffstat (limited to 'Lib/ocaml/typemaps.i')
-rw-r--r--Lib/ocaml/typemaps.i4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/ocaml/typemaps.i b/Lib/ocaml/typemaps.i
index 2bf456a46..6eebd7987 100644
--- a/Lib/ocaml/typemaps.i
+++ b/Lib/ocaml/typemaps.i
@@ -353,6 +353,10 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
%swig_enum_out(varout)
%swig_enum_out(directorin)
+%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
+ $1 = ($1_ltype) caml_string_val($input);
+ $2 = ($2_ltype) caml_string_len($input);
+}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }