FGSL
Fortran interface for the GNU scientific library
|
Please go to api/error.finc for the API documentation.
The error handling subroutines are available from Fortran, with exception of the macros GSL_ERROR
and GSL_ERROR_VAL
. A user-defined error handler can be defined either in C or using a Fortran function with the bind(c)
attribute. Here is the description of the required interface:
subroutine errhand(reason, file, line, errno) bind(c) type(c_ptr), value :: reason, file integer(c_int), value :: line, errno end subroutine errhand
An object of type fgsl_error_handler_t
is returned by the constructor fgsl_error_handler_init(errhand)
, which takes a subroutine with the interface described above as its argument. The subroutine fgsl_error(reason, file, line, errno)
works in an analogous manner as the C version. If the Fortran preprocessor is supported, it should be possible to use the macros __FILE__
and __LINE__
in the above call. Once not needed any more, the error handler object can be deallocated by calling the subroutine fgsl_error_handler_free
with itself as its only argument. Note that the function fgsl_strerror
returns a string of length fgsl_strmax
.