R-beta: dyn.load: incompatability between R and S

Ross Ihaka (ihaka@stat.auckland.ac.nz)
Fri, 25 Jul 1997 13:41:38 +1200 (NZST)

Date: Fri, 25 Jul 1997 13:41:38 +1200 (NZST)
Message-Id: <199707250141.NAA00719@stat1.stat.auckland.ac.nz>
From: Ross Ihaka <ihaka@stat.auckland.ac.nz>
To: Jonathan Myles <jonathan.myles@mrc-bsu.cam.ac.uk>
Subject: R-beta: dyn.load: incompatability between R and S
In-Reply-To: <199707241656.RAA21898@genin.mrc-bsu.cam.ac.uk>

Jonathan Myles writes:

 > However, in R although the first two statements execute OK, the third
 > produces 
 > > dyn.load("/homef/jonm/postdocs/GLMM_project/Cprogs/nn/ars.o")
 > Error in dyn.load(x) : ld.so.1: /scratch0/jonm/R-0.50-a1/bin/R.binary: fatal: re
 > location error: symbol not found: unitexp: referenced in /homef/jonm/postdocs/GL

The problem is that our "dyn.load" expects to get a shared library
rather than just a compiled binary file.  You could take a look at
the code in demos/dynload to see how this works.  Under SunOS you
would do
	gcc -g -fpic misc.c random.c ars.c
	ld -assert pure-text misc.o random.o ars.o -o mylib.so
and then in R
The Makefile in demos/dynload may contain flags that will work
(no promises though).

We do it this way because linking with shared libraries is a much more
portable solution.  I suppose we should change the name to
dyn.load.lib or something.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch