R-beta: R62.3 crash

Martyn Plummer plummer at iarc.fr
Mon Sep 14 11:37:28 CEST 1998


On 14-Sep-98 Jim Lindsey wrote:
>  Well I have finally had a crash, but I am not sure that it can be
>entirely blamed on R.

I don't think it can be blamed on R at all. You are trying to call
a function in one dynamic library from another dynamic library.
We had a discussion about this back in May on R-devel (q.v. the archives).

1) Because R loads dynamic libraries without the RTDL_GLOBAL flag,
external symbols defined in the library are not made available to
subsequently loaded libraries (see dlopen man page). 

2) You could fix your problem by ORing RTDL_LAZY with RTDL_GLOBAL in
the call to dlopen (src/unix/dynload.c). Guido Masarotto gave
a trivial example to demonstrate this.

3) Although this solution works on Linux, it may not work on other
operating systems.

4) I suggested a more portable solution: use the function R_FindSymbol
to get a pointer to a function in a previously loaded library. This is
just what dotcode.c does. I have a modified version of Guido's example
to demonstrate this which I'll repost if you like.

(There is a license issue here, since I believe that if you make
direct calls to R internals rather than using the R language interface,
your code must be GPL)

Martyn

>  I reorganized my libraries to cut out overlap by putting all
>functions (R, C, and Fortran) used by several libraries in a separate
>library that is required by the four others. Some C code is called
>directly by R functions in several libraries, and not just through an
>R function interface. When I load a library, R does not complain
>(although it now checks resolving functions in dynamic loading and
>complains if there is a problem in other situations). But when I use a
>function in one of my main libraries that requires a C function in the
>utilities library, R promptly crashes saying that it cannot resolve
>the function call. (Note that the same C function can be dynamically
>loaded simultaneously in several libraries without conflict; I had
>been doing this all along and have gone back to doing it.)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list