There are currently two auxillary arguments to the dyn.load() function which controls how dynamically loadable libaries are integrated into an R process. These are `local' and `now'. These control whether The default values for these are TRUE and TRUE indicating that the symbols are loaded locally and resolved on immediately the DLL is loaded.

To test these flags, we have 2 libraries:, has a routine, foo() that requires a symbol Rso() available in

We first examine the effect of lazy loading, deferring the resolution of the undefined symbols until they are needed.

# Missing symbol
> dyn.load("")   # Fails, missing symbol Rso

# lazy loading
>  dyn.load("", , now = FALSE) # Success, but don't call foo().
> .C("selfReliant")

In selfReliant() (bar.c in

Now, let's look at the sharing of symbols between libraries. We saw that if we attempt to load the library using the default argument values, we are missing the symbol Rso(). This is available in Restart R.
> dyn.load("")  # default arguments so loads locally
> dyn.load("")        # Fails since Rso is not globally accessible.
Now, start R again.
> dyn.load("", local = FALSE) # load globally
> dyn.load("")         # success.
Note that the symbols in do not have to be loaded globally, just to the donor DLL. Now we can call foo() in and all the symbols will be resolved correctly.
> .C("foo")

Second External foo()
In Rso.

The code for these simple examples is available as a GNU-zipped tar file R-dynload.tar.gz. Feel free to whatever you want with it.
  tar zxvf R-dynload.tar.gz
will extract its contents.
Duncan Temple Lang <>
Last modified: Sun Aug 29 11:02:14 EDT 1999