R-alpha: Re: Static load of executables

Peter Dalgaard BSA (pd@kubism.ku.dk)
Thu, 15 Aug 1996 11:33:23 +0200

Date: Thu, 15 Aug 1996 11:33:23 +0200
Message-Id: <199608150933.LAA00480@bush.kubism.ku.dk>
From: Peter Dalgaard BSA <pd@kubism.ku.dk>
To: dunne@matilda.vut.edu.au
In-Reply-To: Robert Dunne's message of Thu, 15 Aug 96 14:23:13 EST
Subject: R-alpha: Re: Static load of executables

[orig post follows below]

Probably the best answer here is "cool it!". A month or two ago, Ross
stated that resolving the linking issues was to be one of the main
things for the NEXT alpha version of R.

At any rate, I think you need to supply us with more information.
These matters are highly system dependent and you're not even telling
us what kind of machine you are working on.  

Do you have dynamic linking working? (E.g. Linux does not have it
working "out of the box" yet, although the changes needed are quite
trivial -- BTW: Ross + Robert, you know all about this, right?).

Your problem could be as simple as a superfluous underscore on the
symbol name for ANY .C call [dotcode.c -- findDynProc -- sprintf(buf,
"_%s", name); -- remove underscore on ELF/Linux and maybe others].  

Another thing may be that you need to set some link flag to make
object names visible to dlsym() and friends. Something like that was
necessary for dyn.load on Linux.  I *think* it's just "-r", but it's
been a while.


In article <9608150423.AA06406@yarra.vut.edu.au.vut.edu.au> Robert
Dunne <dunne@yarra.vut.edu.au> writes:

> hi R  users,
> does anyone know of a way to do "static" loading of an executable into R?
> The reason I want to do this is that I want to debug fortran code 
> that is linked to R.
> The S+ way of doing this is to do a static loading and then attach the gdb 
> debugger to the running S+ process, put a breakpoint in the fortran code and 
> then call the fortran function from within S+ (thanks to 
> David M. Smith who explained this on aus.stats.s).
> I tried to do this with the zero.c example in demos/dynload. This is what I did
> 1)I first put zero.c in the src/main directory, edited the Makefile and
>    compiled R.
> 2) nm revealed that the symbols "zero_find", etc are in fact loaded into R
> lycra> nm R.binary |grep zero_find
>        0806e2a0 T zero_find
> 3) I ran R and tried to call zero_find
> >cube1 <- function(x) (x^2+1)*(x-1.5)
> >x0 <- zero(cube1, c(0,5))
>   Error in .C("zero_find",  : C/Fortran function not in load table
> and it tells me that the function is not in the load table.
> Any ideas about how can I get it into the load table?
> 			thanks all

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch