r-lib / cpp11

cpp11 helps you to interact with R objects using C++ code.
https://cpp11.r-lib.org/
Other
193 stars 46 forks source link

FR: cpp_register() could allow non-.cpp extensions #292

Closed MichaelChirico closed 1 year ago

MichaelChirico commented 1 year ago

Here, the resulting cpp11 file is hard-coded to have extension .cpp:

https://github.com/r-lib/cpp11/blob/df6d0eae400733efec1ebd92b5cf72f0a6c90264/R/register.R#L41

But sometimes we may need to write .cc extensions (e.g. if the other source files are also written as .cc).

Is there any reason not to offer an extra argument (extension = ".cpp") to allow this customization?

Happy as ever to file a PR :)


FWIW, on GitHub I see ~160M files with extension .cpp, vs. ~50M for .cc

romainfrancois commented 1 year ago

No particular reason, I'll review a PR :)