Skip to content
Prev 10942 / 63424 Next

Segmentation fault in .Call() (PR#4761)

jerome@hivnet.ubc.ca wrote:
Thanks for the info.  This should definitely not cause a segfault.
However, the explanation means that the cure is not obvious without
upsetting quite a lot of people.  Let me explain what happens.

Without the PACKAGE argument in the .Call(), we look for the symbol
"log" by walking through the array of previously loaded DLLs/shared
libraries.  Many of the standard packages use registration of the
routines that are to be called by R via the
.C/.Call/.Fortran/.External interaces. However, they also permit the
DLL to be searched using regular dynamic lookup.  This is the default
so as not to break anyone's S code that uses non-registered routines.
And this is what causes the problem!  In my case, we first look in the
methods library (although this is not important) and as for the symbol
"log". And we find it there on Linux.  Precisely why is very much
system-dependent and installation depdenent.  

Peforming the dynamic lookup is the problem.  If everyone were to use
registration, then we could turn this off, but that is a little too
much to ask (currently :-)).  If you had asked for a different symbol
and not something that was in the system libraries, the result would
have been better.

This did reveal a bug in that the base library has the dynamic lookup
turned on which it should not.  Trivial fix in progress.

I doubt too many people will get into this particular situation, so I
am not certain the fix is better than the event of small
probability. Opinions?

Thanks,

 D.

  
    
Message-ID: <20031024180154.B20750@jessie.research.bell-labs.com>
In-Reply-To: <200310242130.h9OLUS0P016175@pubhealth.ku.dk>; from jerome@hivnet.ubc.ca on Fri, Oct 24, 2003 at 11:30:28PM +0200