Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register function with namespace #262

Open
nbenn opened this issue Feb 4, 2022 · 0 comments
Open

Register function with namespace #262

nbenn opened this issue Feb 4, 2022 · 0 comments

Comments

@nbenn
Copy link

nbenn commented Feb 4, 2022

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

cpp11/R/register.R

Lines 171 to 176 in c22dc9b

{return_type} {name}({real_params});
extern "C" SEXP _{package}_{name}({sexp_params}) {{
BEGIN_CPP11
{calls}
END_CPP11
}}

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 main...nbenn:main and I'm happy to clean this up a bit, add some tests and submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant