Open kevinushey opened 10 years ago
Maybe I'm not following, but is this not what [[Rcpp::interfaces(cpp)]]
gives you ?
That's a bit different, I think -- it makes the C/C++ functions callable by other packages, whereas I'm thinking about influencing how one calls a C/C++ function within their own package. Ie, being able to use
.Call(Cdo_something, ..., PACKAGE=<pkg>)
vs
.Call("do_something", ..., PACKAGE=<pkg>)
in my own package <pkg>
.
The compileAttributes()
-generated RcppExports.R
defaults to the second form, while the first form is a bit faster as it avoids symbol lookup. This could be used with both vanilla C code and Rcpp code.
This is mostly motivated by 5.4 and 5.4.1 in the R-exts manual.
Ah. ok. With you now. I definitely find this interesting.
Once I'm done with #1 we should have attributes
parsing files and structuring the data in some way, possibly just R lists ...
The idea eventually would be that package foo
can create foo::bar
attributes to do stuff with the parsed data.
Just an idea, one thing that would be really nice to see for a package using
attributes
: automatic registration of C routines that we want exported to a package's namespace. So, if I write something likewe can auto-generate a file, say
<pkgname>_init.c
insrc
that containsWe could then avoid the small overhead with dynamic symbol lookup and automate the drudgery of writing this ourselves.
Rcpp-exported functions could be parsed from the
RcppExports.cpp
file generated fromcompileAttributes
, so the pre-package-build workflow would just beWorth the investment?