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: Central.so, T.so.

T.so has a routine, foo() that requires a symbol Rso() available in Central.so

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

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

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

In selfReliant() (bar.c in T.so)
list()

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

Second External foo()
In Rso.
list()


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 <duncan@research.bell-labs.com>
Last modified: Sun Aug 29 11:02:14 EDT 1999