[Rd] Package with multiple shared libraries

Andreas Borg andreas.borg at unimedizin-mainz.de
Tue Nov 16 09:20:57 CET 2010


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.



More information about the R-devel mailing list