diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-02-05 13:35:43 -0700 |
---|---|---|
committer | Zackery Spytz <zspytz@gmail.com> | 2019-02-05 13:35:43 -0700 |
commit | 828ce477c8e7791f718cb01616e0bf80c2773e02 (patch) | |
tree | e49617ae3bd87b573baa3cab191f9fa6dcd61e94 /Source/Modules/ocaml.cxx | |
parent | df86ec5af6985fc1ada3945237dcf34113db6512 (diff) | |
download | swig-828ce477c8e7791f718cb01616e0bf80c2773e02.tar.gz |
[OCaml] Fix a bug in the ctors of director classes
If a class was given the director feature, it was not possible
to use ctors with multiple parameters.
Add director_default_runme.ml (it is based on
director_default_runme.java).
Diffstat (limited to 'Source/Modules/ocaml.cxx')
-rw-r--r-- | Source/Modules/ocaml.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index 99f2a98d7..752e6231f 100644 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -752,14 +752,15 @@ public: } } - if (expose_func) - Printf(f_mlbody, - "external %s_f : c_obj list -> c_obj list = \"%s\" ;;\n" - "let %s arg = match %s_f (fnhelper arg) with\n" - " [] -> C_void\n" + if (expose_func) { + Printf(f_mlbody, "external %s_f : c_obj list -> c_obj list = \"%s\" ;;\n", mangled_name, wname); + Printf(f_mlbody, "let %s arg = match %s_f (%s(fnhelper arg)) with\n", mangled_name, mangled_name, + in_constructor && Swig_directorclass(getCurrentClass()) ? "director_core_helper " : ""); + Printf(f_mlbody, " [] -> C_void\n" "| [x] -> (if %s then Gc.finalise \n" " (fun x -> ignore ((invoke x) \"~\" C_void)) x) ; x\n" - "| lst -> C_list lst ;;\n", mangled_name, wname, mangled_name, mangled_name, newobj ? "true" : "false"); + "| lst -> C_list lst ;;\n", newobj ? "true" : "false"); + } if ((!classmode || in_constructor || in_destructor || static_member_function) && expose_func) Printf(f_mlibody, "val %s : c_obj -> c_obj\n", mangled_name); |