Skip to content

Pass String from R to C

5 messages · Jaimin Dave, Duncan Murdoch

#
On 11-04-23 7:04 PM, Jaimin Dave wrote:
See Writing R Extensions.  The declaration should be char **str.

Duncan Murdoch
1 day later
#
On 25/04/2011 12:51 PM, Jaimin Dave wrote:
str is a pointer to an array of pointers to strings.  That's what char** 
means.  So you need to declare it that way, and use it that way.

This works for me:

File test.c:

void test(char **str)
{
   Rprintf("%s",*str);
}

Duncan Murdoch
#
On 25/04/2011 1:03 PM, Duncan Murdoch wrote:
Oops, I just noticed that the include was missing.  The full file should 
have

#include "R.h"

at the beginning.

Duncan Murdoch