diff options
author | Joris Gillis; u0052373 <joris.gillis@kuleuven.be> | 2016-08-02 13:05:14 +0200 |
---|---|---|
committer | Joris Gillis; u0052373 <joris.gillis@kuleuven.be> | 2016-08-02 13:05:14 +0200 |
commit | 91aba1ec313dda19bb78d9a1c5c00cff5f800928 (patch) | |
tree | 307d9c11a4947af58a1e9ae5d849711770c9a5eb | |
parent | 03261ee8fd39559ab8aec4c907fe956ac2f586cf (diff) | |
download | swig-91aba1ec313dda19bb78d9a1c5c00cff5f800928.tar.gz |
MATLAB directors; fix for void functions
-rw-r--r-- | Source/Modules/matlab.cxx | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/Source/Modules/matlab.cxx b/Source/Modules/matlab.cxx index a01e76f64..a58f74816 100644 --- a/Source/Modules/matlab.cxx +++ b/Source/Modules/matlab.cxx @@ -1833,17 +1833,27 @@ int MATLAB::classDirectorMethod(Node *n, Node *parent, String *super) { if (use_parse) { } else { Printf(w->code, "mxArray* dispatch_in[%d] = {swig_get_self()%s};\n", Len(parse_args)+1, arglist); - Printf(w->code, "mxArray* dispatch_out[%d];\n", outputs); - Printf(w->code, "mxArray* error = SWIG_Matlab_CallInterpEx(%d, dispatch_out, %d, dispatch_in, \"%s\");\n", - outputs, Len(parse_args)+1, symname); - Printf(w->code, "mxArray* %s = dispatch_out[0];\n",Swig_cresult_name()); + if (outputs) { + Printf(w->code, "mxArray* dispatch_out[%d];\n", outputs); + Printf(w->code, "mxArray* error = SWIG_Matlab_CallInterpEx(%d, dispatch_out, %d, dispatch_in, \"%s\");\n", + outputs, Len(parse_args)+1, symname); + Printf(w->code, "mxArray* %s = dispatch_out[0];\n",Swig_cresult_name()); + } else { + Printf(w->code, "mxArray* error = SWIG_Matlab_CallInterpEx(0, 0, %d, dispatch_in, \"%s\");\n", + Len(parse_args)+1, symname); + } } } else { Printf(w->code, "mxArray* dispatch_in[1] = {swig_get_self()};\n"); - Printf(w->code, "mxArray* dispatch_out[%d];\n", outputs); - Printf(w->code, "mxArray* error = SWIG_Matlab_CallInterpEx(%d, dispatch_out, 1, dispatch_in, \"%s\");\n", + if (outputs) { + Printf(w->code, "mxArray* dispatch_out[%d];\n", outputs); + Printf(w->code, "mxArray* error = SWIG_Matlab_CallInterpEx(%d, dispatch_out, 1, dispatch_in, \"%s\");\n", outputs, symname); - Printf(w->code, "mxArray* %s = dispatch_out[0];\n",Swig_cresult_name()); + Printf(w->code, "mxArray* %s = dispatch_out[0];\n",Swig_cresult_name()); + } else { + Printf(w->code, "mxArray* error = SWIG_Matlab_CallInterpEx(0, 0, 1, dispatch_in, \"%s\");\n", + symname); + } } // todo: destroy // todo: exception handling |