[Rd] Package with multiple shared libraries

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Nov 15 12:02:02 CET 2010


R CMD INSTALL is R code, and you can read it for yourself rather than 
asking other people to do so for you.  If you look in
tools:::.install.packages you will see

         shlib_install <- function(instdir, arch)
         {
             files <- Sys.glob(paste0("*", SHLIB_EXT))
             if (length(files)) {
             ...

so it does in general install all the *.so or *.dll's generated.  I am 
not aware of a package that does so for more than one, though.

On Mon, 15 Nov 2010, Andreas Borg wrote:

> Dear R-devel members,
>
> I would like to compile a package with two seperate shared libraries. For 
> example, in a package 'foo', a file 'bar.so' built from a distinct set of 
> source files should be installed in addition to the default 'foo.so' (or .dll 
> on windows). Does anyone know about a way to achieve this without having a 
> custom Makefile, e.g. via 'Makevars'?
>
> Also, I'd be thankful for information on existing packages which make use of 
> this or a similar customization.
>
> Just in case anyone is interested in details: I have some C-code which is not 
> intended to be loaded into R but into a SQLite database to which I connect 
> via RSQLite. I would like to have these object in a seperate library.

In which case it seems that the library should not be in the package's 
libs directory, which is intended for DSO/DLLs to be loaded into R.

If you want to do this in a public package you need to remember that 
multiple architectures are used on Mac OS and Windows.

> Thanks and kind regards,
>
> Andreas
>
> -- 
> Andreas Borg
> Medizinische Informatik
>
> UNIVERSITÄTSMEDIZIN
> der Johannes Gutenberg-Universität
> Institut für Medizinische Biometrie, Epidemiologie und Informatik
> Obere Zahlbacher Straße 69, 55131 Mainz
> www.imbei.uni-mainz.de
>
> Telefon +49 (0) 6131 175062
> E-Mail: borg at imbei.uni-mainz.de

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-devel mailing list