Thank you for finding a solution Johannes. I've never worked with mex/GSL myself.
If the default handler is used, then the program will abort/segfault anyway, so I don't think it should matter if you are calling from mex or from a command line. On 10/18/2018 11:26 PM, Johannes Hendriks wrote: > Dear sir/madam, > > I would like to close this thread as it has been resolved. The problem > ended up being the combination of the default error handler along with the > mex compiler. The default error handler would do use 'printf' to output > error message to screen and abort the function. Unfortunately this would > cause matlab to crash as output to display requires mexPrintf when using > mex compiler. > > So I recognise this is not a bug in your functions. However, maybe it would > be good to highlight somewhere that if mex is being used then the default > error handler needs to be disabled / replaced. I am sure there are quite a > few academic and research users who might come across this problem. > > Regards, > Johannes > > On Wed, Oct 17, 2018 at 1:18 PM Johannes Hendriks < > [email protected]> wrote: > >> Dear sir/madam >> >> I have found a possible issue with the gsl_integration_qng >> and gsl_integration_qag functions. Under particular conditions when these >> functions fail to meet the specified relative or absolute tolerance, >> instead of failing gracefully they are causing a seg fault. >> >> I am running on osx 10.12.6 and compiling using the matlab mex compiling. >> I have matlab 2017b, and am compiling with the command >> >> mex intTwoK_mex.c -I/usr/local/include/ -lmwlapack -lmwblas -lgsl >> >> I have attached a zip file containing a matlab script that will cause the >> integration routine to fault. >> >> Let me know if you require any further infomation. >> >> Regards, >> Johannes Hendriks >> >> >>
