Re: [Rd] Problems with calloc function.

2006-01-05 Thread Paul Roebuck
On Tue, 3 Jan 2006, Marcelo Damasceno wrote: > Sorry about my incautiousness, I use the tips, but is > happen same problems. Not really. You definitely skipped over the most important one - don't terminate the host process. > if(temp4 == NULL){ > printf("\n\n No Memory4!"); >

Re: [Rd] Problems with calloc function.

2006-01-05 Thread Hin-Tak Leung
Hi Marcelo, You need to read the R extension manual more carefully... Basically you haven't deference thed pointers. You think you were allocating say, col=2, but instead you were allocating &col in int's, the address of col, which is a large number since user-land memory address starts at a large

Re: [Rd] Problems with calloc function.

2006-01-03 Thread Marcelo Damasceno
Hello all and Prof. Brian Ripley , Sorry about my incautiousness, I use the tips, but is happen same problems. Below the R code. rspcplot <- function(file1="dg_01.lab.txt"){ if(is.null(n)) stop("You need first run the function

Re: [Rd] Problems with calloc function.

2005-12-29 Thread Prof Brian Ripley
Rather than trying to reinvent the wheel, why not make use of the functions documented in Writing R Extensions, especially Calloc/Free? And definitely do not call exit() from code linked into R: it is antisocial behaviour to terminate your host's process. Your example is incomplete, and for s

[Rd] Problems with calloc function.

2005-12-29 Thread Marcelo Damasceno
Hi all, I have a C code in Linux, it has 7 pointers and compile e run OK, but when I run in R happens problems with calloc function, it returns NULL. ### > int *temp1,*temp2,*temp3,*temp4; temp1 = (int *)calloc(col,sizeof(int)); if(temp1 == NULL){