[Rd] Why no race condition when returning UNPROTECT-ed memory from C?

2010-04-13 Thread Dominick Samperi
Consider the C (or C++) code called from the .Call interface: SEXP foo() { SEXP *p = PROTECT(allocVector(REALSXP, 10)); ... UNPROTECT(1); return p; } Why is there no danger that the allocated memory will be garbage collected after the UNPROTECT, but before the return of p? I have used cod

Re: [Rd] SHLIB works but inline compilation does not

2010-04-13 Thread Sharpie
Jeff Brown wrote: > > Hi, > > I appear to be able to compile, load and call shared objects using SHLIB > and .Call: > >> code <- '#include \n #include \n SEXP f(){\n return >> R_NilValue ; }' >> writeLines( code, "test.c" ) >> system( "R CMD SHLIB test.c" ) > gcc -arch i386 -std=gnu99 > -I/L

Re: [Rd] .Fortran interface error

2010-04-13 Thread Sharpie
jgarcia-2 wrote: > > Yes That's it! Thanks a lot!! > Changing UNIT=5 in the F95 code by UNIT=7 solves the collision. > > Thank you very much Charlie, I've spent a lot of hours with this. > I'm glad it worked! Google seems to indicate that units 0, 5, 6, 100, 101 and 102 are speci

Re: [Rd] .Fortran interface error

2010-04-13 Thread jgarcia
Yes That's it! Thanks a lot!! Changing UNIT=5 in the F95 code by UNIT=7 solves the collision. Thank you very much Charlie, I've spent a lot of hours with this. Still R -d valgrind --vanilla < foofortran.Rcheck/foofortran-Ex.R gives 3 errors (two "Invalid read of size 8" and one "Sys

[Rd] Summary, was Re: R CMD check tells me 'no visible binding for global variable ', what does it mean?

2010-04-13 Thread Michael Dewey
At 16:24 12/04/2010, Henrik Bengtsson wrote: On Mon, Apr 12, 2010 at 5:08 PM, Duncan Murdoch wrote: > On 12/04/2010 10:51 AM, Michael Dewey wrote: >> Just to draw a line under it my comment inline below >> When I run R CMD check on a package I have recently started work on I get >> the foll

Re: [Rd] .Fortran interface error

2010-04-13 Thread Sharpie
jgarcia-2 wrote: > > Hi, > I've stripped all the code, and it seems that any simple attempt to > open/close a file from fortran is the cause of the error, and the error > appears in f77 as well as in f95 code. Please, find attached a foo package > that reproduce the errors, it should build/check

[Rd] Job: AHL Research Developer, R/python - top hedge fund, Oxford/London UK

2010-04-13 Thread Sklyar, Oleg (London)
Dear list subscribers, this is posted in appreciation of the level of skill that subscribers to this mailing list enjoy and in no way to abuse it. We are looking to hire a Research Developer with extensive R and/or python development skills. If interested (below), please contact me directly on

[Rd] svn.r-project.org with new trusted certificate

2010-04-13 Thread Martin Maechler
The SVN (Subversion) Server of the R-project, svn.r-project.org, financed and run by the Math Department of ETH Zurich, now has got it's own "validated" aka "trusted" SSL certificate, mostly thanks to Simon Urbanek (R-core) and his employer, AT&T Labs. This may mean that those of you who have been

Re: [Rd] Getting started with .C

2010-04-13 Thread Jeff Brown
That is tremendously helpful.  Thanks Charlie! --- On Mon, 4/12/10, Sharpie [via R] wrote: From: Sharpie [via R] Subject: Re: Getting started with .C To: "Jeff Brown" Date: Monday, April 12, 2010, 10:11 PM Jeff Brown wrote: Hi, I'm trying to learn to use .C, which lets one invoke comp

Re: [Rd] .Fortran interface error

2010-04-13 Thread jgarcia
Hi, I've stripped all the code, and it seems that any simple attempt to open/close a file from fortran is the cause of the error, and the error appears in f77 as well as in f95 code. Please, find attached a foo package that reproduce the errors, it should build/check/install without any problem (it

Re: [Rd] .Fortran interface error

2010-04-13 Thread Prof Brian Ripley
Please try running this under valgrind (see 'Writing R Extensions'). The most likely cause is that the Fortran code is corrupting its or R's memory. You may need a build of R set up to instrument R allocations (see the manual for details). On Tue, 13 Apr 2010, jgar...@ija.csic.es wrote: Hi

[Rd] .Fortran interface error

2010-04-13 Thread jgarcia
Hi all, I'm preparing a package which uses .Fortran to interface a Fortran 95 function. This F95 function simply receives the name of a file from R, opens this file and forwards its content to a F95 module, which, in turn, makes the real computation. The F95 module is a pre-existing one and I'm tr

[Rd] Multicore mapply

2010-04-13 Thread David Rossell
Quick question regarding multicore versions of mapply. Package 'multicore' provides a parallelized version of 'lapply', called 'mclapply'. I haven't found any parallelized versions of 'mapply', however (although one can use the lower level function 'parallel', it becomes harder to control the numbe