[Rd] reusing routines

Duncan Temple Lang duncan at wald.ucdavis.edu
Sun May 14 01:21:47 CEST 2006


Hi Terry.

If I am inferring correctly from your description, in S-Plus
your C code for the microarray automatically finds the cholesky2 routine
in the survival package without any need to tell it to do so.
While it may be convenient, this is not very desirable at all.
Rather, you should have to tell the microarray C code about
cholesky2 when compiling and linking that code.

You didn't mention which operating system you and your colleague
are each using.  But perhaps the local argument of dyn.load()
may work for you; use
   dyn.load(system.file("libs",
                        paste("survival", .Platform$dynlib.ext, sep =""),
                        package = "survival"),
            local = FALSE)


Then  dyn.load() the other dynamically loadable library which uses 
cholesky2.

   In the next few months, we'll be able to link native code from one 
package into another and this is a much more sensible approach than
using the global symbol table and risking conflicts and ambiguities.

  D.

Terry Therneau wrote:
>    I've created some Splus code for a microarray problem that
> 	- needed to be in C, to take advantage of some sparse matrix
> properties
> 	- uses a cholesky decompostion as part of the computation
> 
>  For the cholesky, I used the cholesky2 routine, which is a part of the
> survival library.  It does just what I want and I'm familiar with it (after
> all, I wrote it).  
> 
>   In Splus, this all works fine.  A colleague working on the same problem
> prefers R; things don't work there.  The dyn.load command complains that
> the routine is not found, even when the survival library is already loaded.
> 
>   I looked at the manual page for dyn.load, but don't see anything.  What
> are we missing?
> 
>   Please reply via email, as I don't read this list.  (But I likely will start
> to later this summer, when I port the newest mixed-effects Cox model code
> over from S).
> 
> 	Terry Therneau
> 	Mayo Clinic
> 	therneau.terry at mayo.edu
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list