Open nbenn opened 2 years ago
When registering a function in a namespace such as
[[cpp11::register]] int foo::bar(int a) { return a; }
decor recognizes the function name as foo::bar and all would be fine (as far as I can tell), if the generated extern "C" wrapper
foo::bar
extern "C"
https://github.com/r-lib/cpp11/blob/c22dc9b611fe7d56ddfc57add2e01b1424869c0f/R/register.R#L171-L176
would not blindly forward the ::. Some further minor adjustments are required for the generation of the R-side functions. For the R-side function name, we could for example strip away anything that comes before the last scope resolution operator.
::
I started putting something together under https://github.com/r-lib/cpp11/compare/main...nbenn:main and I'm happy to clean this up a bit, add some tests and submit a PR.
When registering a function in a namespace such as
decor recognizes the function name as
foo::bar
and all would be fine (as far as I can tell), if the generatedextern "C"
wrapperhttps://github.com/r-lib/cpp11/blob/c22dc9b611fe7d56ddfc57add2e01b1424869c0f/R/register.R#L171-L176
would not blindly forward the
::
. Some further minor adjustments are required for the generation of the R-side functions. For the R-side function name, we could for example strip away anything that comes before the last scope resolution operator.I started putting something together under https://github.com/r-lib/cpp11/compare/main...nbenn:main and I'm happy to clean this up a bit, add some tests and submit a PR.