From ripley at stats.ox.ac.uk  Thu Jul 31 20:39:14 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu, 31 Jul 2008 19:39:14 +0100 (BST)
Subject: [Rd] C versions of serialize/unserialize in packages
In-Reply-To: <alpine.LFD.1.10.0807311623390.654@gannet.stats.ox.ac.uk>
References: <66f3bd910807310635k19c9379dve8f44998ebc164f7@mail.gmail.com>
	<alpine.LFD.1.10.0807311623390.654@gannet.stats.ox.ac.uk>
Message-ID: <alpine.LFD.1.10.0807311938310.26279@gannet.stats.ox.ac.uk>

On Thu, 31 Jul 2008, Prof Brian Ripley wrote:

> 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 years.)

Sorry the cut-and-paste went wrong: R_InitConn(In|Out)PStream only.

>
> 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
>
> ______________________________________________
> 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



[Rd] C versions of serialize/unserialize in packages
Prof Brian Ripley