1#' @useDynLib rlang, .registration = TRUE
2NULL
3
4# For cnd.R
5is_same_body <- NULL
6
7
8base_ns_env <- NULL
9base_pkg_env <- NULL
10
11.onLoad <- function(lib, pkg) {
12  if (getRversion() < "3.5") {
13    is_same_body <<- function(x, y) identical(x, y)
14  } else {
15    is_same_body <<- is_reference
16  }
17
18  check_linked_version(pkg, with_rlang = FALSE)
19
20  check_downstream_deps(
21    pkg,
22    dplyr = c(min = "0.8.0", from = "0.4.0"),
23    with_rlang = FALSE
24  )
25
26  on_package_load("glue", .Call(rlang_glue_is_there))
27
28  .Call(r_init_library)
29  .Call(rlang_library_load, ns_env("rlang"))
30
31  run_on_load()
32
33  s3_register("pillar::pillar_shaft", "quosures", pillar_shaft.quosures)
34  s3_register("pillar::type_sum", "quosures", type_sum.quosures)
35
36  base_ns_env <<- ns_env("base")
37  base_pkg_env <<- baseenv()
38}
39.onUnload <- function(lib) {
40  .Call(rlang_library_unload)
41}
42
43on_package_load <- function(pkg, expr) {
44  if (isNamespaceLoaded(pkg)) {
45    expr
46  } else {
47    thunk <- function(...) expr
48    setHook(packageEvent(pkg, "onLoad"), thunk)
49  }
50}
51