[DynareDev] [Trac] #137: remove occurences of mexErrMsgTxt() in all MEX files

Trac Dynare root at dynare.org
Tue Sep 14 15:29:27 CEST 2010


#137: remove occurences of mexErrMsgTxt() in all MEX files
--------------------------+-------------------------------------------------
 Reporter:  sebastien     |       Owner:     
     Type:  enhancement   |      Status:  new
 Priority:  critical      |   Milestone:  4.2
Component:  Core M-files  |     Version:     
 Keywords:                |  
--------------------------+-------------------------------------------------
 This function throws a C++ exception, which is not handled correctly by
 MinGW for 64-bit (at the current time).

 It appears that the benefits of using MinGW on Windows 64 are greater than
 the inconvenience of not using that function.

 In case of error, MEX files should print a meaningful message with
 mexPrintf(), and then return control to MATLAB (with return()). A new
 output argument of the MEX file should be dedicated to informing MATLAB of
 the error condition (the output argument can be 0 in case of success, 1 in
 case of error). The MATLAB code should check that argument, and in case of
 failure should run "error('MEX failed')" to interrupt the execution of the
 code.

 Note that it is still possible to use C++ exceptions inside the MEX
 function (as is currently done in k_order_perturbation), so that all error
 conditions can be catched by the top-level mexFunction().

-- 
Ticket URL: <https://www.dynare.org/trac/ticket/137>
Dynare <http://www.dynare.org>
The Dynare project


More information about the Dev mailing list