summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2022-10-10 18:55:37 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2022-10-10 18:55:37 +0100
commit0239ba5536105bec1ac4c2386b10a300e9a483cd (patch)
treee42c19d64603b4fbfd37734b95775cfee1220764
parent2f55379687a394e941a20e2224eb1125d66720cd (diff)
downloadswig-0239ba5536105bec1ac4c2386b10a300e9a483cd.tar.gz
OCaml director return fix
Fixes director_unwrap_result testcase when returning Element *const *&
-rw-r--r--Source/Modules/ocaml.cxx15
1 files changed, 4 insertions, 11 deletions
diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx
index 7ea453132..c6748f571 100644
--- a/Source/Modules/ocaml.cxx
+++ b/Source/Modules/ocaml.cxx
@@ -1647,20 +1647,13 @@ public:
/* any existing helper functions to handle this? */
if (!is_void) {
if (!(ignored_method && !pure_virtual)) {
- /* A little explanation:
- * The director_enum test case makes a method whose return type
- * is an enum type. returntype here is "int". gcc complains
- * about an implicit enum conversion, and although i don't strictly
- * agree with it, I'm working on fixing the error:
- *
- * Below is what I came up with. It's not great but it should
- * always essentially work.
- */
+ String *rettype = SwigType_str(returntype, 0);
if (!SwigType_isreference(returntype)) {
- Printf(w->code, "CAMLreturn_type((%s)c_result);\n", SwigType_lstr(returntype, ""));
+ Printf(w->code, "CAMLreturn_type((%s)c_result);\n", rettype);
} else {
- Printf(w->code, "CAMLreturn_type(*c_result);\n");
+ Printf(w->code, "CAMLreturn_type((%s)*c_result);\n", rettype);
}
+ Delete(rettype);
}
} else {
Printf(w->code, "CAMLreturn0;\n");