[Rd] .Call and Segmentation Fault

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Aug 31 00:03:21 CEST 2005


Ricardo Luiz Andrade Abrantes <rabrantes82 at gmail.com> writes:

> Hello to everybody!
> After reading all the C code, checking for problems, and find nothing, I 
> decided something a little bit different...
> If my ".so" library works in a wrog way in R it should do the same in C. So 
> I created a C program that loads my library file and the executes the same 
> function R is executing.
> The program worked perfectly! In fact I changed two things in my library: 
> The function I call now return an int, not a SEXP, and the return value is 0 
> not R_NilValue.
> Valgrind's output is ok too... 
> If .Call has no problems, and if my function works perfect when called from 
> a C program, where the problem lies? Why my program becomes "crazy" when I 
> run it from R?
> I would apreciate very much your help! I don't where else I could find help 
> on this.

Well, did you try running under a debugger? 

  R -d gdb 

then "bt" after the segfault. (Make sure that things are compiled with
-g option)



-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-devel mailing list