.check_and_compile_TMB_code | R Documentation |
This utility function verifies whether the TMB model shared object (.so/.dll
) file
has already been compiled for a specified DLL name. If not, it compiles the
corresponding C++ file and caches it in a persistent directory across R sessions.
.check_and_compile_TMB_code(
dll_name,
pkg_name = "gkwreg",
force_recompile = FALSE,
verbose = FALSE
)
dll_name |
A character string specifying the base name of the C++ file
and the resulting DLL. The function assumes the code file is |
pkg_name |
A character string specifying the package name. Defaults to "gkwreg". |
force_recompile |
Logical; if |
verbose |
Logical; if |
The function works through the following steps:
Creates a persistent cache directory for storing compiled TMB models.
Checks if a compiled file for the specified DLL already exists in the cache directory and whether it's up-to-date compared to the source code.
If a valid compiled file exists, it loads it directly.
If not, the function locates the corresponding C++ file inside the package, compiles it, and stores the result in the cache directory.
Provides diagnostic messages regarding compilation status and exported symbols.
Returns (invisibly) a list with information about the compiled model, including path, normalized path, name, and compilation status. If any step fails, an error is thrown.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.