Dynamic loading is implemented by the S function dyn.load
.
(See "The New S Language", Ch. 7, pgs 193-204).
This function will take the object file (typically output
by a C or Fortran compiler) and load it into memory so that
it can be executed by the S functions .C()
or .Fortran()
.
During the loading, dyn.load()
attempts to resolve any references
to other routines. These references can come from explicit
subroutine calls or from implicit calls to library routines.
Unfortunately, the implementation of dyn.load()
is difficult and
dependent on hardware and the operating system, so the AT&T distribution
of S provides it for Vax and Motorola 68000-based architectures.
AT&T does not supply dyn.load
for Sun's Sparc architecture.
MathSoft provides a working version of dyn.load
, dyn.load2
,
and/or dyn.load.shared
for each Unix architecture on which S-PLUS
runs.
For more info, See section What is the statlib
server? How can I access it?.
Static loading is another way of loading subroutines with S. Static loading creates a local version of S in your current working directory. Remember, however, that a copy of S requires about 6Mb of space and must be recreated whenever changes are made to S.
You would use static loading if:
dyn.load
.
dyn.load()
/dyn.load2()
would
be too slow. A particular example is when the loaded code depends
on libraries and dyn.load2()
complains about missing or duplicate
symbols, since dyn.load2
is slow it may be faster in this case to
use static loading instead of repeated calls to dyn.load2
.
Yes, you can use the function call_S
within C to call an S/S-PLUS
function from within a C program. See section 7.2.4 of the blue book,
and SPLUS reference manual.
Note that C code calling S must be linked into the S executable
(via dynamic or static loading).
Go to the first, previous, next, last section, table of contents.