Re: [Rd] .Call and Segmentation Fault

2005-09-04 Thread Ricardo Luiz Andrade Abrantes
I think I did. But if I don't, (1) my OS is Linux (Debian) kernel 2.6.8, R version 2.1.1. (2) I generate the shared lib with a cutom makefile: FC = g77 CC = gcc RC = R CMD SHLIB CFLAGS = -Df2cFortran -I/usr/local/lib/R/include -I/usr/local/include -g3 -shared -fPIC FFLAGS = -g3 -shared -fPIC al

Re: [Rd] .Call and Segmentation Fault

2005-09-04 Thread Peter Dalgaard
Ricardo Luiz Andrade Abrantes <[EMAIL PROTECTED]> writes: > Hello there! > I almost don't deal with SEXPs. The function's name is main() it returns a > SEXP wich is R_NilValue, thats all I use of SEXPs. This function call an > optimization packge and the output goes all to a text file. > Well, I

Re: [Rd] .Call and Segmentation Fault

2005-09-04 Thread Ricardo Luiz Andrade Abrantes
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >

Re: [Rd] .Call and Segmentation Fault

2005-08-31 Thread Huntsinger, Reid
ction from C. How do you deal with SEXPs? Reid Huntsinger Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ricardo Luiz Andrade Abrantes Sent: Tuesday, August 30, 2005 4:33 PM To: r-devel@r-project.org Subject: Re: [Rd] .Call and Segmentat

Re: [Rd] .Call and Segmentation Fault

2005-08-30 Thread Thomas Lumley
On Tue, 31 Aug 2005, Peter Dalgaard wrote: > 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) It would also be worth renaming the the function -- while I don't see exactly how it could be causing the

Re: [Rd] .Call and Segmentation Fault

2005-08-30 Thread Peter Dalgaard
Ricardo Luiz Andrade Abrantes <[EMAIL PROTECTED]> 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 p

Re: [Rd] .Call and Segmentation Fault

2005-08-30 Thread Ricardo Luiz Andrade Abrantes
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

[Rd] .Call and Segmentation Fault

2005-08-30 Thread Ricardo Luiz Andrade Abrantes
I forgot to put the folowing includes in my last post: #include #include Thanks, Ricardo -- Forwarded message -- From: Ricardo Luiz Andrade Abrantes <[EMAIL PROTECTED]> Date: Aug 30, 2005 1:37 PM Subject: Re: [Rd] .Call and Segmentation Fault To: Simon Urbanek &

Re: [Rd] .Call and Segmentation Fault

2005-08-30 Thread Ricardo Luiz Andrade Abrantes
Hi Simon! You are right! Ok, here it is (a little resumed): #include #include #include #include #include "interface.h" SEXP main() { int gtype, inform, m, n, maxoutit, maxtotit, maxtotfc, outiter, totcgcnt, totfcnt, totgcnt, totiter, iprint, ncomp, i; double f,nalpsupn,epsfeas,epsopt,snorm;

Re: [Rd] .Call and Segmentation Fault

2005-08-28 Thread Ricardo Luiz Andrade Abrantes
> It cannot be .Call: your .Call passed no parameters so there was nothing > to be uninitialized. I did ask you why you were doing that. This .Call without parameters is just for a test. I am constructing an interface to this C/Fortran optimization package, and because this segmentation fault pr

Re: [Rd] .Call and Segmentation Fault

2005-08-27 Thread Prof Brian Ripley
On Sat, 27 Aug 2005, Ricardo Luiz Andrade Abrantes wrote: > Hi! > Yes, I am returning a SEXP from the functions called from R, and the > problem occurs before (thousands of iterations before) the return > point. > In fact I runned valgrind into R and when I call ".Call(...) " I got > many errors l

Re: [Rd] .Call and Segmentation Fault

2005-08-27 Thread Ricardo Luiz Andrade Abrantes
Hi! Yes, I am returning a SEXP from the functions called from R, and the problem occurs before (thousands of iterations before) the return point. In fact I runned valgrind into R and when I call ".Call(...) " I got many errors like: ==4324== Use of uninitialised value of size 8 ==4324==at 0x1CB

[Rd] .Call and Segmentation Fault

2005-08-26 Thread Ricardo Luiz Andrade Abrantes
Hello to everyone! I use .Call to call a C function without arguments wich calls a fortran optimization package. My C function uses others C and Fortran functions and it works fine when I call it from a main() in a C program. But when I call it from R with .Call("name_of_the_c_function"), R gives m

Re: [Rd] .Call and Segmentation Fault

2005-08-26 Thread Byron Ellis
Are you returning a SEXP? .Call (unlike .C) expects a SEXP return value. It sounds like you're returning garbage and R is choking on that when it tries to use the address as a SEXP. On Aug 26, 2005, at 3:19 PM, Ricardo Luiz Andrade Abrantes wrote: > Hello to everyone! > I use .Call to call a

[Rd] .Call and Segmentation Fault

2005-08-26 Thread Ricardo Luiz Andrade Abrantes
Hello to everyone! I use .Call to call a C function without arguments wich calls a fortran optimization package. My C function uses others C and Fortran functions and it works fine when I call it from a main() in a C program. But when I call it from R with .Call("name_of_the_c_function"), R gives m