[R] Using libRmath.a in Fortran?

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu Sep 6 08:15:34 CEST 2001


Göran Broström <gb at stat.umu.se> writes:

> Is it possible to call the routines in the standalone library
> libRmath from Fortran programs? I'm using g77 on Linux.

Not directly. Look at e.g.

double dweibull(double x, double shape, double scale, int give_log)

this uses call-by-value semantics, where Fortran always uses
call-by-reference, i.e. pointers. So, notwithstanding linker and
symbol naming issues, you would at the very least have to write 
wrapper functions to the tune of

double dweibw(double *x, double *shape, double *scale, int *give_log)
{
        return dweibull(*x, *shape, *scale, *give_log);
}

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list