Skip to content
Prev 643 / 12125 Next

[R-pkg-devel] How to pass a connection into a C function (R 3.2)

I would like to implement a package that contains a C function that writes to a connection.
So the R_ext/Connections.h defines what a connection IS, but not how to get one.

What seems to work is to manually declare
Rconnection getConnection(int n);
In my C file, and while this works, and I can then use the connection object, it fails package validation with:

?Found non-API call to R: ?getConnection?
Compiled code should not call non-API entry points in R.?

So how am I supposed to do this? Is there a way? Or do I just live with the check warning (ideally not)?

Thanks.