jaeandersson / swig

SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.
http://www.swig.org
Other
23 stars 19 forks source link

Refactor error handling #58

Closed jaeandersson closed 8 years ago

jaeandersson commented 9 years ago

Right now errors messages in the wrappers raise warnings instead of errors in MATLAB followed by a generic error message at the end. It should be possible to avoid these warning messages by instead constructing an MException array with all the error information and return this to the mexFunction gateway.

This means function signature of the structure of the wrapper functions from:

int _wrap_foo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
 ...
}

to

mxArray* _wrap_foo(int resc, mxArray *resv[], int argc, mxArray *argv[]) {
 ...
}

On success, it would return 0 (cf. mexCallMATLABWithTrap).

jaeandersson commented 9 years ago

@jgillis - I think it could this could avoid the use of matlabprepend/matlabappend.

KrisThielemans commented 9 years ago

how's this related to Issue #48

jaeandersson commented 9 years ago

48 is indeed essentially a duplicate of this, I'll close that one. See also my comment there though.

jaeandersson commented 8 years ago

Resolved.