Skip to content

useDynLib in older versions e.g. (2.10)

5 messages · Brian Ripley, Tobias Abenius, Uwe Ligges

#
Hi,

Has something changed regarding the useDynLib in the NAMESPACE file in 
packages? I've written a package that works in e.g. 2.12/2.13 but simply 
cannot find the dynamic library under windows. The version on CRAN is 
older than the one I'm talking about and depends on a newer version of R 
but I want to make the package available to people with older versions.

 > utils:::menuInstallLocal()
package 'lassoshooting' successfully unpacked and MD5 sums checked
 > require(lassoshooting)
Loading required package: lassoshooting
Error in library.dynam(lib, package, package.lib) :
   shared library 'lassoshooting' not found
In addition: Warning message:
package 'lassoshooting' was built under R version 2.13.0

I'm usually under linux and don't know about the gory details of .dll files.

NAMESPACE file
--------------
useDynLib(lassoshooting)
export(lassoshooting)

happy easter!

regards, Tobias
#
On Wed, 20 Apr 2011, Tobias Abenius wrote:

            
No.  As the FAQ asked re bug reports, please don't post speculation 
rather than problem description.
Do you mean 'make a binary version of the package ....'?
Binary packages are (on all platforms, but specifically on Windows and 
Mac OS X) intended for use only on the same 2.x.[012] versions of R.
That warning was not meant to be ignored!

If you had bothered to read the CHANGES file you would known that the 
location of files on Windows binary installations changed in R 2.12.0: 
of course there is no way that R 2.10.0 (as the posting guide points 
out there is no '2.10') could know that was going to be changed a year 
later.

The solution is for you to prepare a binary package for each version 
of R you want it available with and make it available on your own 
repository.

  
    
#
On 20.04.2011 13:30, Tobias Abenius wrote:
Yes, your package was built doe R-2.13.0 but you are using R <= 2.12.0 
where the dll files were located in a different directory.
Hence a) time to upgrade your R version or b) Install the package from 
sources yourself for the (unstated) version of R on your Windows machine.

Uwe Ligges
#
Dear R-devel,

I investigated further by tracing into library.dynam.
The .dll file export a symbol "ccd". In e.g. R 2.8.1 the following 
command succeeds,

dyn.load('/Program 
Files/R/R-2.8.1/library/lassoshooting/libs/i386/lassoshooting.dll')

and the external symbol "ccd" becomes available.

However, inside library.dynam it doesn't add i386 to the path because
  .Platform$r_arch is "". One way would be to re-zip the package with a 
copy of the i386 version outside of the i386 directory, directly under 
libs. That would work, but then I know I cannot commit a binary package 
to CRAN. I guess I'm not the only one having this problem.

Happy easter, Tobias
#
On 21.04.2011 11:30, Tobias Abenius wrote:
I think you are mislead:
CRAN accepts source packages only. Binaries are made by CRAN (or more 
particular by myself in Dortmund). For new packages or updates as of 
today, we make binaries for R-2.12.x and R-2.13.x available. Note that 
between major releases of R, you cannot assume that packages will work. 
The help system changed in R-2.10.x (and no binaries are compatible 
before vs. after the R-2.10.0 version) and the location of libraries in 
R-2.12.x changed under Windows.

If you need a binary for R-2.8.x, you will have to INSTALL from sources 
with R-2.8.x, otherwise we cannot guarantee compatibility. Note that 
R-2.8.1 is unsupported and 5 major releases back!

Uwe Ligges