[R-pkg-devel] .Fortran opinion

Avraham Adler @vr@h@m@@d|er @end|ng |rom gm@||@com
Sun May 26 22:09:24 CEST 2019


If you read further in Drew's posts (which I highly recommend) he says
that C++/Rcpp isn't the best for wrapping Fortran calls, and that it
is faster and cleaner to use C. I have a relatively detailed blog post
on building packages with Fortran (or raw C) code; I hope you may find
it useful in your case [1].

Thanks,

Avi

[1] https://www.avrahamadler.com/2018/12/09/the-need-for-speed-part-1-building-an-r-package-with-fortran/

On Sun, May 26, 2019 at 3:22 PM Neal Fultz <nfultz using gmail.com> wrote:
>
> I think the current best practice is to wrap the Fortran code in a C
> helper, and invoke that using .Call - more information on that is available
> in Hadley's book - http://adv-r.had.co.nz/C-interface.html
>
> It shouldn't be too much work, maybe another 10-20 lines of code, most of
> which could probably autogenerated using Rcpp if you wanted to take that
> route.
>
> On Sun, May 26, 2019 at 6:31 AM Berry Boessenkool <
> berryboessenkool using hotmail.com> wrote:
>
> >
> > Recently, users of my package rdwd have provided Fortran code for a nice
> > extension of the package.
> > According to the following site, calling .Fortran() is no longer
> > recommended:
> > https://github.com/wrathematics/Romp/blob/master/README.md#fortran
> >
> > Since this is my first time using native code, I'd highly appreciate any
> > thoughts on the following question:
> > How much additional work should I put into avoiding .Fortran() for
> > long-term CRAN suitability?
> >
> > Thanks ahead,
> > Berry
> >
> > PS: In case you want a look at the (two very short) Fortran routines:
> > https://github.com/brry/rdwd/tree/master/src
> > and their call in R:
> > https://github.com/brry/rdwd/blob/master/R/readRadarFile.R#L119
> >
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-package-devel using r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-package-devel
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list