But that's what I want to do, create the connection in R code and pass it on to 
the C function.
My question is, how do I do that?
You appear to need the C getConnection entry point, but it's not part of the 
API. 
So I'm wondering how I'm supposed to do what you describe.

Sorry if I was unclear.

Sent from my iPhone

>> On 21 Jan 2016, at 5:44 pm, Duncan Murdoch <murdoch.dun...@gmail.com> wrote:
>> 
>> On 21/01/2016 11:39 AM, Tom Quarendon wrote:
>> 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)?
> 
> The usual way to do that would be to create the connection in R code, and 
> pass it in with your call.
> 
> If you don't know what connection you need at the time you call your C code, 
> you can evaluate an R expression from C to do the same, but this is 
> relatively tricky, so I'd advise the other method.
> 
> Duncan Murdoch
______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to