From andreas.borg at unimedizin-mainz.de  Tue Nov 16 09:20:57 2010
From: andreas.borg at unimedizin-mainz.de (Andreas Borg)
Date: Tue, 16 Nov 2010 09:20:57 +0100
Subject: [Rd] Package with multiple shared libraries
In-Reply-To: <alpine.LFD.2.00.1011151051490.10769@gannet.stats.ox.ac.uk>
References: <4CE1072C.8010709@unimedizin-mainz.de>
	<alpine.LFD.2.00.1011151051490.10769@gannet.stats.ox.ac.uk>
Message-ID: <4CE23EE9.8000303@unimedizin-mainz.de>

Thanks for your reply. Actually my problem is not how to install the 
libraries in the sense of copying them to the right place, but how to 
build more than one .so or .dll file. Anyway, I did read the code and 
found that absence of a Makefile, a single library is built from all 
source files in directory src:

                  srcs <- dir(pattern = "\\.([cfmM]|cc|cpp|f90|f95|mm)$")

                  [...]

                          has_error <- run_shlib(pkg_name, srcs,
                            instdir, "")

where the last call basically executes R CMD SHLIB on the sources.

So a custom Makefile seems the only feasible solution. Still I'd be 
thankful to know about other packages (if they exist) which create other 
than the standard library files.

Best regards,

Andreas

Prof Brian Ripley schrieb:
> 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
>


-- 
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

Diese E-Mail enth?lt vertrauliche und/oder rechtlich gesch?tzte Informationen. Wenn Sie nicht der
richtige Adressat sind oder diese E-Mail irrt?mlich erhalten haben, informieren Sie bitte sofort den
Absender und l?schen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe
dieser Mail und der darin enthaltenen Informationen ist nicht gestattet.



[Rd] Package with multiple shared libraries
Andreas Borg