There was a question earlier today, on either r-help or r-devel, about calling R code from FORTRAN (I deleted it accidentally, so I don't know which list it belonged to). Anyway, there is a workaround to call R functions from FORTRAN which is used in the "integrate" library. It was invented for S by Mike Meyer. The FORTRAN code needs to be written to call a fixed C function and pass it a pointer to the R function. The C function then uses call_S to call the R function. As everything is passed by reference in FORTRAN the argument is automatically a pointer. Since the FORTRAN code never does anything with the pointer except pass it, you can declare the argument to have any type you like. "integrate" declares the function pointer to be DOUBLE PRECISION. In principle on some machines there could be alignment issues, but this would only be a problem if the FORTRAN compiler insisted on checking the alignment of a pointer it never dereferenced. Thomas Lumley ------------------------------------------------------+------ Biostatistics : "Never attribute to malice what : Uni of Washington : can be adequately explained by : Box 357232 : incompetence" - Hanlon's Razor : Seattle WA 98195-7232 : : ------------------------------------------------------------ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-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 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=