Karl Forner
2010-Sep-16 16:11 UTC
[Rd] Possible bug or annoyance with library.dynam.unload()
Hello, I have a package with a namespace. Because I use Roxygen that overwrites the NAMESPACE file each time it is run, I use a R/zzz.R file with an .onLoad() and .onUnload() functions to take care of loading and unloading my shared library. The problem: if I load my library from a local directory, then the unloading of the package fails, e.g: # loads fine>library(Foo, lib.loc=".Rcheck")>unloadNamespace("Foo")Warning message: .onUnload failed in unloadNamespace() for 'Foo', details: call: library.dynam.unload("Foo", libpath) error: shared library 'Foo' was not loaded # I traced it a little:>library.dynam.unload("Foo", ".Rcheck/Foo")Error in library.dynam.unload("Foo", ".Rcheck/Foo") : shared library 'Foo' was not loaded # using an absolute path works>library.dynam.unload("Foo", "/home/toto/.Rcheck/Foo")So from what I understand, the problem is either that the relative libpath is sent to the .onUnload() function instead of the absolute one, or that library.dynam.unload() should be modified to handle the relative paths. Am I missing something ? What should I do ? Thanks, Karl [[alternative HTML version deleted]]
Karl Forner
2010-Sep-21 14:38 UTC
[Rd] Possible bug or annoyance with library.dynam.unload()
Hello, I got no reply on this issue. It is not critical and I could think of work-around, but it really looks like a bug to me. Should I file a bug-report instead of posting in this list ? Thanks, Karl On Thu, Sep 16, 2010 at 6:11 PM, Karl Forner <karl.forner@gmail.com> wrote:> Hello, > > I have a package with a namespace. Because I use Roxygen that overwrites > the NAMESPACE file each time it is run, I use a R/zzz.R file with > an .onLoad() and .onUnload() functions to take care of loading and > unloading my shared library. > > The problem: if I load my library from a local directory, then the > unloading of the package fails, e.g: > > # loads fine > >library(Foo, lib.loc=".Rcheck") > > >unloadNamespace("Foo") > Warning message: > .onUnload failed in unloadNamespace() for 'Foo', details: > call: library.dynam.unload("Foo", libpath) > error: shared library 'Foo' was not loaded > > # I traced it a little: > >library.dynam.unload("Foo", ".Rcheck/Foo") > Error in library.dynam.unload("Foo", ".Rcheck/Foo") : > shared library 'Foo' was not loaded > > # using an absolute path works > >library.dynam.unload("Foo", "/home/toto/.Rcheck/Foo") > > > So from what I understand, the problem is either that the relative libpath > is sent to the .onUnload() function instead of the absolute one, > or that library.dynam.unload() should be modified to handle the relative > paths. > > Am I missing something ? What should I do ? > > Thanks, > > > Karl >[[alternative HTML version deleted]]