Register function with namespace

Aperta
#262 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
cpp, r
Ambito
tooling

Direzione di ricerca

Start in R/register.R at the wrapper-generation code linked in the issue, then trace how decor records namespaced functions and how R-side functions are generated. Add or extend tests for registering foo::bar and verify that the generated extern "C" wrapper and R-side function use valid names. The existing comparison branch may provide useful context.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

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.

Lingua principale
C++
Stelle
224
Fork
52
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di r-lib/cpp11

Tutte le issue di r-lib/cpp11

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.