[R] C structures in R

2006-12-01 Thread Barry Rowlingson
Is it safe to call C code from R that mallocs memory for a structure, returning a pointer to that structure via some 'raw()' parameter. Then, pass that pointer to another C routine, and finally free the malloced memory by passing the raw() data to another C routine? I've written some code that

Re: [R] C structures in R

2006-12-01 Thread Prof Brian Ripley
Isn't this a question clearly in R-devel's domain? R-devel is intended for questions and discussion about code development in R. Questions likely to prompt discussion unintelligible to non-programmers should go to to R-devel. The short answer is that quite a bit of code, e.g pwilcox and

Re: [R] C structures in R

2006-12-01 Thread Barry Rowlingson
Prof Brian Ripley wrote: The short answer is that quite a bit of code, e.g pwilcox and RODBC, does things like this. You don't need to pass the pointer back to R, but if you do external pointers are designed for this job. [reads a bit more of 'Writing R Extensions'...] Right yes,

Re: [R] C structures in R

2006-12-01 Thread Martin Maechler
BaRow == Barry Rowlingson [EMAIL PROTECTED] on Fri, 01 Dec 2006 14:09:13 + writes: BaRow Prof Brian Ripley wrote: The short answer is that quite a bit of code, e.g pwilcox and RODBC, does things like this. You don't need to pass the pointer back to R, but if you do