[Rd] C versions of serialize/unserialize in packages

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jul 31 17:43:32 CEST 2008

On Thu, 31 Jul 2008, Roger D. Peng wrote:

> Are the functions 'R_Unserialize' and 'R_InitFileInPStream' allowed to
> be used in R packages?  I guess I'm just not clear on the implications
> of this comment in 'Rinternals.h':
> /* The connection interface is not yet available to packages.  To
>   allow limited use of connection pointers this defines the opaque
>   pointer type. */

It applies to R_InitFile(In|Out)PStream only, and is conditionalized by
NEED_CONNECTION_PSTREAMS.  You can't create a Rconnection pointer in your 
own C code in a public way.  (The 'yet' has been there for nearly 7 

So what you are asking about is outside the conditional for that comment.

> I have a function in the 'filehash' package that unserializes a bunch
> of objects from a file and it seems to run much faster in C than in R.
> But I don't want to release something that uses a non-public
> function/interface.
> Thanks,
> -roger
> -- 
> Roger D. Peng | http://www.biostat.jhsph.edu/~rpeng/
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list