Zhang, Jitao David
2020-Apr-17 07:29 UTC
[Rd] Demo for linking native routines between R packages
Dear R developers, I want to advertise a small project for the educational purpose to show people how to link native routines. In R programming, we need to link to native routines in C, C++, or Fortran from the R environment. In most cases, the linking works within one package, namely the R code in a package calls the native code in the same package. This is not necessarily always the case. Sometimes, a piece of C or R code in a package needs to link to native routines in another R package. The *Writing R Extensions manual describes *how to do this in the section *Linking to native routines in other packages*. However, some details were not clear to me, and I could find no demo dedicated to this purpose. Therefore, I decided to build a demo that is available at my Github repository Accio/demo-linking-native <https://github.com/Accio/demo-linking-native>. Besides implementing the linking of native routines between R packages, the project also documents issues that I met and how I solved them. In case you find the demo useful or you have suggestions on how to improve it, please let me know. I wonder whether you think it is a good idea to suggest to the core team to add the project to the manual so that other people can understand the process better with the demo. In case of questions, let me know. Best wishes, David -- *Dr. Jitao David Zhang | ??? | A Computational Biologist in Drug Discovery* *Building 93/3.38, **Tel +41 61 688 62 51* *Roche Pharmaceutical Research and Early Development (pRED) | Pharmaceutical Sciences, BiOmics, BEDA (see http://**go.roche.com/BEDA <http://go.roche.com/BEDA>**) | Roche Innovation Center Basel | F. Hoffmann-La-Roche AG | CH-4070 Basel | Switzerland* *Core working hours - No Meetings: Mo/8:30-16:00; Tu/8:30-17:00; We/8:30-16:00; Th/9:00-11:30* *Available for meetings: Mo/16:00-17:00; We/16:00-17:00**; Th/11:00-17:00; Fr/8:00-10:00* Confidentiality Note: This message is intended only for ...{{dropped:13}}
Davis Vaughan
2020-Apr-17 13:12 UTC
[Rd] Demo for linking native routines between R packages
Nice David! I also wrote up something similar a little while back https://github.com/DavisVaughan/cexport -Davis On Fri, Apr 17, 2020 at 7:09 AM Zhang, Jitao David via R-devel < r-devel at r-project.org> wrote:> Dear R developers, > > I want to advertise a small project for the educational purpose to show > people how to link native routines. > > In R programming, we need to link to native routines in C, C++, or Fortran > from the R environment. In most cases, the linking works within one > package, namely the R code in a package calls the native code in the same > package. > > This is not necessarily always the case. Sometimes, a piece of C or R code > in a package needs to link to native routines in another R package. > The *Writing > R Extensions manual describes *how to do this in the section *Linking to > native routines in other packages*. However, some details were not clear to > me, and I could find no demo dedicated to this purpose. > > Therefore, I decided to build a demo that is available at my Github > repository Accio/demo-linking-native > <https://github.com/Accio/demo-linking-native>. Besides implementing the > linking of native routines between R packages, the project also documents > issues that I met and how I solved them. > > In case you find the demo useful or you have suggestions on how to improve > it, please let me know. I wonder whether you think it is a good idea to > suggest to the core team to add the project to the manual so that other > people can understand the process better with the demo. > > In case of questions, let me know. > > Best wishes, > David > > -- > > *Dr. Jitao David Zhang | ??? | A Computational Biologist in Drug Discovery* > > *Building 93/3.38, **Tel +41 61 688 62 51* > > *Roche Pharmaceutical Research and Early Development > (pRED) | Pharmaceutical Sciences, BiOmics, BEDA (see http://** > go.roche.com/BEDA > <http://go.roche.com/BEDA>**) | Roche Innovation Center Basel | F. > Hoffmann-La-Roche AG | CH-4070 Basel | Switzerland* > *Core working hours - No Meetings: Mo/8:30-16:00; Tu/8:30-17:00; > We/8:30-16:00; Th/9:00-11:30* > *Available for meetings: Mo/16:00-17:00; We/16:00-17:00**; Th/11:00-17:00; > Fr/8:00-10:00* > > Confidentiality Note: This message is intended only for ...{{dropped:13}} > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >[[alternative HTML version deleted]]
Zhang, Jitao David
2020-Apr-17 13:14 UTC
[Rd] Demo for linking native routines between R packages
Dear Davis, Thank you a lot for sharing this, and I am happy that I was not the only one who need to do it once to learn:) I proposed to add my repo to the manual. I think it makes sense to add both of ours, if possible, or we could merge them together and add that to the manual. Long-term URL stability is apparently an issue, but I think we may find a solution there. Anyway, thanks a lot for sharing! Best wishes, David On Fri, Apr 17, 2020 at 3:12 PM Davis Vaughan <davis at rstudio.com> wrote:> Nice David! I also wrote up something similar a little while back > https://github.com/DavisVaughan/cexport > > -Davis > > On Fri, Apr 17, 2020 at 7:09 AM Zhang, Jitao David via R-devel < > r-devel at r-project.org> wrote: > >> Dear R developers, >> >> I want to advertise a small project for the educational purpose to show >> people how to link native routines. >> >> In R programming, we need to link to native routines in C, C++, or Fortran >> from the R environment. In most cases, the linking works within one >> package, namely the R code in a package calls the native code in the same >> package. >> >> This is not necessarily always the case. Sometimes, a piece of C or R code >> in a package needs to link to native routines in another R package. >> The *Writing >> R Extensions manual describes *how to do this in the section *Linking to >> native routines in other packages*. However, some details were not clear >> to >> me, and I could find no demo dedicated to this purpose. >> >> Therefore, I decided to build a demo that is available at my Github >> repository Accio/demo-linking-native >> <https://github.com/Accio/demo-linking-native>. Besides implementing the >> linking of native routines between R packages, the project also documents >> issues that I met and how I solved them. >> >> In case you find the demo useful or you have suggestions on how to improve >> it, please let me know. I wonder whether you think it is a good idea to >> suggest to the core team to add the project to the manual so that other >> people can understand the process better with the demo. >> >> In case of questions, let me know. >> >> Best wishes, >> David >> >> -- >> >> *Dr. Jitao David Zhang | ??? | A Computational Biologist in Drug >> Discovery* >> >> *Building 93/3.38, **Tel +41 61 688 62 51* >> >> *Roche Pharmaceutical Research and Early Development >> (pRED) | Pharmaceutical Sciences, BiOmics, BEDA (see http://** >> go.roche.com/BEDA >> <http://go.roche.com/BEDA>**) | Roche Innovation Center Basel | F. >> Hoffmann-La-Roche AG | CH-4070 Basel | Switzerland* >> *Core working hours - No Meetings: Mo/8:30-16:00; Tu/8:30-17:00; >> We/8:30-16:00; Th/9:00-11:30* >> *Available for meetings: Mo/16:00-17:00; We/16:00-17:00**; Th/11:00-17:00; >> Fr/8:00-10:00* >> >> Confidentiality Note: This message is intended only for ...{{dropped:13}} >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> >-- *Dr. Jitao David Zhang | ??? | A Computational Biologist in Drug Discovery* *Building 93/3.38, **Tel +41 61 688 62 51* *Roche Pharmaceutical Research and Early Development (pRED) | Pharmaceutical Sciences, BiOmics, BEDA (see http://**go.roche.com/BEDA <http://go.roche.com/BEDA>**) | Roche Innovation Center Basel | F. Hoffmann-La-Roche AG | CH-4070 Basel | Switzerland* *Core working hours - No Meetings: Mo/8:30-16:00; Tu/8:30-17:00; We/8:30-16:00; Th/9:00-11:30* *Available for meetings: Mo/16:00-17:00; We/16:00-17:00**; Th/11:00-17:00; Fr/8:00-10:00* Confidentiality Note: This message is intended only for ...{{dropped:13}}