Skip to contents

Loads bytecode compiled by cmpfile into an environment.

Usage

loadcmp(file, envir)

Arguments

file

Path to the compiled .Rc file.

envir

The environment to load into, use .GlobalEnv to load the code into current global session

Value

Invisible NULL.

Examples

tmp_r <- tempfile(fileext = ".R")
tmp_rc <- tempfile(fileext = ".Rc")
writeLines("f <- function(x) x * 2", tmp_r)
cmpfile(tmp_r, tmp_rc)
#> saving to file "/tmp/RtmpMmDEdi/file19436a802ce2.Rc" ... done
loadcmp(tmp_rc, .GlobalEnv)
f(3)
#> [1] 6