SHLIB {utils} | R Documentation

## Build Shared Library for Dynamic Loading

### Description

Compile the given source files and then link all specified object files into a shared library which can be loaded into R using `dyn.load` or `library.dynam`.

### Usage

    R CMD SHLIB [options] [-o libname] files

### Arguments

`files` | a list specifying the object files to be included in the shared library. You can also include the name of source files (for which the object files are automagically made from their sources) and library linking commands.
`libname` | the full name of the shared library to be built, including the extension (typically ‘.so’ on Unix systems). If not given, the name of the library is taken from the first file.
`options` | Further options to control the processing. Use `R CMD SHLIB --help` for a current list.

### Details

`R CMD SHLIB` is the mechanism used by `INSTALL` to compile source code in packages. Please consult section ‘Creating shared objects’ in the manual ‘Writing R Extensions’ for how to customize it (for example to add `cpp` flags and to add libraries to the link step) and for details of some of its quirks.

Items in `files` with extensions ‘.c’, ‘.cpp’, ‘.cc’, ‘.C’, ‘.f’, ‘.f90’, ‘.f95’, ‘.m’, ‘.M’ and ‘.mm’ are regarded as source files, and those with extension ‘.o’ as object files. All other items are passed to the linker.

### Note

Some binary distributions of R have `SHLIB` in a separate bundle, e.g., an `R-devel` RPM.

### See Also

`COMPILE`, `dyn.load`, `library.dynam`.

The section on “Customizing compilation under Unix” in “R Administration and Installation” (see the ‘doc/manual’ subdirectory of the R source tree).

The ‘R Installation and Administration’ and ‘Writing R Extensions’ manuals.

### Examples

    ## Not run:
    R CMD SHLIB -o mylib.so a.f b.f -L/opt/acml3.5.0/gnu64/lib -lacml
    ## End(Not run)

[Package utils version 2.7.1 Index]