Another option you might consider is the non-local exit/goto mechanism that underlies the exception stuff in C++. The functions longjmp and setjmp address your exact concern: these functions can break from an error handler on the top of a stack of gsl functions, way back to a location in your original C++ application code, where you can safely throw an exception. Actually, you would be better off *handling* the exception where your jump lands, because you would have just effectively *thrown* an exception in C :)
On Thu, Aug 04, 2005 at 04:38:06PM +0200, Tommy Nordgren wrote: > > Aug 4, 2005 kl. 4:06 PM skrev Kevin Thornton: > > >How about setting a custom gsl error handler that > >throws an exception? You can set custom error > >handlers for the gsl using routines described here: > >http://www.gnu.org/software/gsl/manual/gsl-ref_3.html#SEC23 > > > > The GSL routines are C: It is impossible for error handlers > called by C > routines to throw an exception, since throwing an exception across a > C routine > will cause the program to be unconditionally terminated by the C++ > exception handling system. > This can only be fixed by recompiling the library source itself with > a C++ compiler. > > > >The functions take char * arguments which can then be > >passed along to exceptions, etc. > > > >This may be a much simpler solution than modifying the > >library itself. > > > >--Kevin > > > >--- Tommy Nordgren <[EMAIL PROTECTED]> wrote: > > > > > >> > >> > >>I'm interested in modifying the GSL source, to make > >>it compile with a > >>C++ > >>compiler instead. I would like suggestions on doing > >>this as easy as > >>possible. > >> > >>The reason I want to do this, is to allow error > >>handlers to throw > >>exceptions, > >>since it's not possible to throw exceptions across > >>code compiled as C++ > >>(If one tries, the exception handling system will > >>exit the app, and > >>this is definitely > >>not what's wanted when doing time-consuming > >>computations) > >> > >>"Home is not where you are born, but where your > >>heart finds peace" - > >>Tommy Nordgren, "The dying old crone" > >> > >> > >> > >>_______________________________________________ > >>Help-gsl mailing list > >>[email protected] > >>http://lists.gnu.org/mailman/listinfo/help-gsl > >> > >> > > > > > >Kevin Thornton > >Committee on Genetics > >University of Chicago > >http://www.molpopgen.org > > > >__________________________________________________ > >Do You Yahoo!? > >Tired of spam? Yahoo! Mail has the best spam protection around > >http://mail.yahoo.com > > > > > >_______________________________________________ > >Help-gsl mailing list > >[email protected] > >http://lists.gnu.org/mailman/listinfo/help-gsl > > > > "Home is not where you are born, but where your heart finds peace" - > Tommy Nordgren, "The dying old crone" > > > > _______________________________________________ > Help-gsl mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/help-gsl -- james bergstra http://www-etud.iro.umontreal.ca/~bergstrj _______________________________________________ Help-gsl mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gsl
