R-alpha: Dynamic loading on HPs

Mike Meyer (mikem@stat.cmu.edu)
Mon, 01 Apr 1996 16:42:40 -0500


Message-Id: <199604012142.QAA29704@desire.stat.cmu.edu>
To: R-testers@stat.math.ethz.ch
Subject: R-alpha: Dynamic loading on HPs
Date: Mon, 01 Apr 1996 16:42:40 -0500
From: Mike Meyer <mikem@stat.cmu.edu>

I seem to have succeeding in getting dynamic loading to work on my HP
system, using the shl_ interface --- which seems to be closely related
to the dlopen stuff.  (HP-UX desire A.09.07 A 9000/770)


Here are two sets of diffs, one for  System/HP
6c6
< SYSTEM= -DHP -DUnix -Dno_f77_underscore
---
> SYSTEM= -DHP -DUnix -Dno_f77_underscore -DProctime -DDLSupport -DSHL
12c12
< # Fortran Compiler and Options
---
> # Fortran Compiler and Options (-E for Dynamic loading)
14c14
< FFLAGS= -O

and one for  src/dotcode.c (I hate all the ifdefs here, but I couldn't
think of a smarter way to do this.  SHL is for the shl interface).

39,41d38
< #ifdef SHL
< #include <dl.h>
< #else
43c40
< #endif
---
> 
48,50d44
< #ifdef SHL
< 	shl_t *ptr;
< #else
52d45
< #endif
58,60d50
< #ifdef SHL
< static void add_ptr(shl_t *p)
< #else
62d51
< #endif
84d72
< #ifndef SHL
86d73
< #endif
89,91d75
< #ifdef SHL
< 	        if (shl_findsym(tmp->ptr, name, TYPE_PROCEDURE, &fcnptr) == 0)
< #else
93d76
< #endif
108,111d90
< /* I have no idea why this needs to be defined out here, but it does */
< #ifdef SHL
< shl_t handle;
< #endif
114d92
< #ifndef SHL
116d93
< #endif
121,125d97
< 	/* Is BIND_DEFERRED the right thing to do? */
< #ifdef SHL
< 	handle = shl_load(CHAR(STRING(CAR(args))[0]), BIND_DEFERRED, 0L);
< 	add_ptr(&handle);
< #else
130c102
< 		free(error); 
---
> 		free(error);
133d104
< #endif

---
> FFLAGS= -O 
22,23c22,23
< # Create an Executable from Objects and Libraries
< LD= f77 -O
---
> # Create an Executable from Objects and Libraries (-E for Dynamic loading)
> LD= f77 -O -Wl,-E
26c26
< LIBS= -lm /usr/lib/X11R5/libX11.a
---
> LIBS= -lm -ldld /usr/lib/X11R5/libX11.a


With these changs, R at least loads the sample zero function.

 --Mike


Mike Meyer, Department of Statistics, Carnegie Mellon University
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-