stan-dev / stan-dev/rstantools
problem exporting Rcpp functions
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 48
- Forks
- 24
- Avg merge
- 1h 17m
- Merged PRs (30d)
- 1
Description
I want to make a C++ function aviliable to R with the // [[Rcpp::export]] command. This does not work when using the rstan.package.skeleton. I get the error "object '[name of the rcpp function]' not found". It appears to be some problem with registering the routine.
However, if I remove lines 16:20 from src\init.cpp the registration works. Here is the code from those lines:
void attribute_visible R_init_sem5r1c(DllInfo *dll) {
// next line is necessary to avoid a NOTE from R CMD check
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, TRUE); // necessary for .onLoad() to work
}
What do these lines of code actually do and are they safe to remove?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read src/init.cpp lines 16:20 and the rstan.package.skeleton-generated registration path, then reproduce the missing-object error with an Rcpp::export function. Done means documenting the role of these lines and determining whether they can be removed without breaking registration or .onLoad().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, r
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100