R: Compile a C++ template to DLL suitable for MakeADFun.

compile {TMB} | R Documentation

## Compile a C++ template to DLL suitable for MakeADFun.

### Description

Compile a C++ template into a shared object file. OpenMP flag is set if the template is detected to be parallel.

### Usage

    compile(file, flags = "", safebounds = TRUE, safeunload = TRUE,
      openmp = isParallelTemplate(file[1]), libtmb = TRUE, libinit = TRUE,
      ...)

### Arguments

`file` | C++ file.
`flags` | Character with compile flags.
`safebounds` | Turn on preprocessor flag for bound checking?
`safeunload` | Turn on preprocessor flag for safe DLL unloading?
`openmp` | Turn on openmp flag? Auto detected for parallel templates.
`libtmb` | Use precompiled TMB library if available (to speed up compilation)?
`libinit` | Turn on preprocessor flag to register native routines?
`...` | Passed as Makeconf variables.

### Details

TMB relies on R's built in functionality to create shared libraries independent of the platform. A template is compiled by `compile("template.cpp")`, which will call R's makefile with appropriate preprocessor flags. Compiler and compiler flags can be stored in a configuration file. In order of precedence either via the file pointed at by R_MAKEVARS_USER or the file ~/.R/Makevars if it exists. Additional configuration variables can be set with the `flags` and `...` arguments, which will override any previous selections.

### See Also

`precompile`

[Package TMB version 1.7.11 Index]