Skip to content

.Call and Segmentation Fault

1 message · Huntsinger, Reid

#
I suggest you look at the code for .Call() in dotcode.c. I suspect the
problem is in dealing with R objects, however. You don't show how you get
from SEXPs to pointers to pass to Fortran, or what the Fortran routine
requires. 

I don't understand how you can call the "same" function from C. How do you
deal with SEXPs? 

Reid Huntsinger

Reid Huntsinger
-----Original Message-----
From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-project.org]
On Behalf Of Ricardo Luiz Andrade Abrantes
Sent: Tuesday, August 30, 2005 4:33 PM
To: r-devel at r-project.org
Subject: Re: [Rd] .Call and Segmentation Fault


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.
I can provide any piece of code that may help, Its just ask!


Thanks,


Ricardo
On 8/28/05, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel