R-alpha: Re: dyn.load() problems

Gregory R. Warnes (warnes@biostat.washington.edu)
Thu, 5 Sep 1996 12:56:00 -0700 (PDT)

Date: Thu, 5 Sep 1996 12:56:00 -0700 (PDT)
From: "Gregory R. Warnes" <warnes@biostat.washington.edu>
To: r-testers <r-testers@stat.math.ethz.ch>
Subject: R-alpha: Re: dyn.load() problems
In-Reply-To: <Pine.SUN.3.91.960905093002.11162A-100000@babcomm>

I found a solution to my problems with dyn.load:

1) I needed to add the flag -rdynamic flag to the LIBS line in 
   $RHOME/src/Systems/Linux so that when dynamic linking was done,
   undefined symbols in the linked object are searched for in R.binary

2) I needed to remove the "_" character that was being prepended to the 
   symbol name by R when calling in $RHOME/src/main/dotcode.c  I do not 
   know if this is appropriate for all systems.  I presume not.

A patch to do both of these is included here:

===start patch====
diff -r --unified /usr/local/oldR/src/Systems/Linux ./Systems/Linux
--- /usr/local/oldR/src/Systems/Linux   Mon Jul  1 16:35:17 1996
+++ ./Systems/Linux     Thu Sep  5 11:33:54 1996
@@ -23,4 +23,4 @@
 LD= gcc -g
 # Libraries to Load Against
-LIBS= -L$(X11BASE)/lib -lX11 -lm
+LIBS= -L$(X11BASE)/lib -lX11 -lm -ldl -rdynamic
diff -r --unified /usr/local/oldR/src/main/dotcode.c ./main/dotcode.c
--- /usr/local/oldR/src/main/dotcode.c  Mon Aug 26 21:11:12 1996
+++ ./main/dotcode.c    Thu Sep  5 12:43:30 1996
@@ -70,7 +69,7 @@
        void *fcnptr;
        char buf[64];
-       sprintf(buf, "_%s", name);
+       sprintf(buf, "%s", name);
        tmp = list;
        while(tmp != NULL){
                if((fcnptr = dlsym(tmp->ptr, buf)) != NULL)
=====end patch=====

    Gregory R. Warnes          | It is high time that the ideal of success
warnes@biostat.washington.edu  |  be replaced by the ideal of service.
                               |                       Albert Einstein

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