Re: [Rd] .Call and Segmentation Fault

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Tue 30 Aug 2005 - 22:03:21 GMT

Ricardo Luiz Andrade Abrantes <rabrantes82@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@biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Aug 31 08:10:34 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:19 GMT