mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 20:36:01 +01:00
Add dummy error handling on the SWIG side
This commit is contained in:
parent
1be899d0c5
commit
5bca219c1b
@ -40,9 +40,26 @@ import_array();
|
||||
%numpy_typemaps(int32_t, NPY_INT32, int64_t)
|
||||
%numpy_typemaps(int64_t, NPY_INT64, int64_t)
|
||||
|
||||
/* Include typemaps generated by the process.py */
|
||||
%include pyqmckl_include.i
|
||||
/* Include typemaps generated by the process_header.py script */
|
||||
%include "pyqmckl_include.i"
|
||||
|
||||
/* exception.i is a generic (language-independent) module */
|
||||
%include "exception.i"
|
||||
/* Error handling
|
||||
TODO: the sizeof() check below if a dummy workaround
|
||||
It is good to skip exception raise for functions like context_create and others, but might fail
|
||||
if sizeof(result) == sizeof(qmckl_exit_code), e.g. for functions that return non-zero integers or floats
|
||||
*/
|
||||
%exception {
|
||||
$action
|
||||
if (result != 0 && sizeof(result) == sizeof(qmckl_exit_code)) {
|
||||
SWIG_exception_fail(SWIG_RuntimeError, qmckl_string_of_error(result));
|
||||
}
|
||||
}
|
||||
|
||||
/* The exception handling above does not work for void functions like lock/unlock so exclude them for now */
|
||||
%ignore qmckl_lock;
|
||||
%ignore qmckl_unlock;
|
||||
|
||||
/* Parse the header files to generate wrappers */
|
||||
%include "qmckl.h"
|
||||
|
Loading…
Reference in New Issue
Block a user