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

Native calls fail after load_all ("not resolved from current namespace") #1465

Closed
mb706 opened this issue Feb 24, 2017 · 2 comments
Closed

Comments

@mb706
Copy link

mb706 commented Feb 24, 2017

devtools::load_all unloads previously loaded DLLs and therefore reorders the LoadedDLL array, but the getCallingDLLe result that R relies upon when looking up DLL objects does not change in the same way. This sometimes leads to not resolved from current namespace errors when an unlucky package calls a .C function.

In the following example, I have cloned the ParamHelpers package to a subdirectory, and I have the lhs package installed in my library. R needs to be run with the --vanilla option to prevent interference from a possible .RData file.

$ R --vanilla
> devtools::load_all("ParamHelpers")
Loading ParamHelpers
Re-compiling ParamHelpers
'/usr/lib64/R/bin/R' CMD INSTALL '/home/user/ParamHelpers' --library='/tmp/RtmproDXbZ/devtools_install_588768c7107c' --no-R --no-data --no-help --no-demo --no-inst --no-docs --no-exec --no-multiarch --no-test-load
make: Nothing to be done for 'all'.
> lhs::maximinLHS(n=2, k=2)  # implicitly load the lhs DLL; works fine here.
          [,1]      [,2]
[1,] 0.6008410 0.9491948
[2,] 0.4723376 0.3303989
> devtools::load_all("ParamHelpers")
Loading ParamHelpers
Re-compiling ParamHelpers
'/usr/lib64/R/bin/R' CMD INSTALL '/home/user/master/ParamHelpers' --library='/tmp/RtmproDXbZ/devtools_install_58874478c51e' --no-R --no-data --no-help --no-demo --no-inst --no-docs --no-exec --no-multiarch --no-test-load
make: Nothing to be done for 'all'.
> lhs::maximinLHS(n=2, k=2)  # does not work                                                                                                                                                                                                               
Error in .C("maximinLHS_C", as.integer(n), as.integer(k), as.integer(dup),  : 
  "maximinLHS_C" not resolved from current namespace (lhs)

P.S.

@hadley
Copy link
Member

hadley commented Aug 1, 2017

Yeah, I think this is out of scope for devtools, since:

  • It's really R's fault
  • There's already an existing best practice (using PACKAGE or registration) that avoids the problem.

@hadley hadley closed this as completed Aug 1, 2017
@lock
Copy link

lock bot commented Sep 18, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants