[Rd] Custom connections

Simon Urbanek simon.urbanek at r-project.org
Tue Jun 13 03:34:10 CEST 2017

> On Jun 12, 2017, at 7:03 PM, Gábor Csárdi <csardi.gabor at gmail.com> wrote:
> Dear all,
> I hope somebody can help me understand if package authors are allowed
> to create custom R connections or not.
> Until today, I thought that R had an "official" way to define custom
> connections. E.g. this is an old commit message that was supposed to
> create an API, maybe internal, though.
>> r62016 | urbaneks | 2013-02-21 14:29:44 -0500 (Thu, 21 Feb 2013) | 1 line
>> add API to create custom connections
> The /src/include/R_ext/Connections.h file mentions "connection APIs".
> "Writing R Extensions" has:
>> Facilities for defining custom connection implementations are provided in
>> R_ext/Connections.h, but make sure you consult the file before use.
> This appeared in the R 3.3.0 NEWS:
>> The connections API now includes a function R_GetConnection() which allows packages
>> implementing connections to convert R connection objects to Rconnection handles used in the
>> API. Code which previously used the low-level R-internal getConnection() entry point should
>> switch to the official API.
> However, from today, the R 3.3.0 NEWS item reads somewhat differently:
> https://github.com/wch/r-source/commit/7e9889fa9bb9269ffadfe67f3ded4bdca51b8ed9
> And perhaps more importantly, R CMD check gives a NOTE about
> R_new_custom_connection and some other connection related functions
> now:
> https://github.com/wch/r-source/commit/e55605767570fc424b6c281e0b7489e8dc77b53f
> I am not sure what this means for package authors.
> Can package authors use R_new_custom_connection to create custom connections?
> If not, is there another way to create custom connections?

No. Unfortunately, recent somewhat careless changes in R-devel have triggered a discussion about the connection API which was broken by that commit so R-devel cannot be used reliably. The API was precisely intended to be used by packages so it's ok to use it on CRAN. Although I cannot speak for the author, I suspect this change merely helps to flag where the API is used to follow the trail of breakage in R-devel.


> Thank you,
> Gabor
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list