On 7 dec 2007, at 00.19, jian Xu wrote:
Hello,
I'm using gsl 1-D root finding algorithm, and I need to use
gsl_root_fsolver_set( ... ) to initilize the solver. The problem is
whenever the root is NOT located inside the bounds, this function
call
will immediately breaks the program. And I cannot catch its error
even if I put this function in a try block:
try
{
gsl_root_fsolver_set (s, &f, x_lo, x_hi);
}
catch(...)
{
throw .......; // Root is not bracked
}
Is there anyway to catch the error generated by
gsl_root_fsolver_set()
? Thanks a lot.
Jian
What you need to do first, is rebuild the GSL library in a way that
allows exceptions to be thrown
past c code. This require a certain option to be passed to gcc,
which is not passed by default.
Then you need to set up an error handler function that throws an
exception, instead of exiting
------------------------------------------------------
"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"
address@hidden