mjaga
mjaga

Reputation: 23

call R's error function from Fortran

How do I call R's built-in functions 'error' and 'warning' from Fortran? It was straight forward to do from C, but if I use something like

call error('an error occured')

in my Fortran code, the dynamic library won't load because of "undefined symbol: error_". I can see that the R CMD SHLIB command links with -lR, so what else would be needed? Do they maybe have a different name when called from Fortran?

Upvotes: 0

Views: 223

Answers (1)

gagolews
gagolews

Reputation: 13066

According to the Writing R Extensions manual,

There are two interface function provided to call error and warning from FORTRAN code, in each case with a simple character string argument. They are defined as:

subroutine rexit(message)
subroutine rwarn(message)

Messages of more than 255 characters are truncated, with a warning.

Upvotes: 1

Related Questions