Hi,
 
Could someone please point to an example of passing strings from .C()
calls back to R? I want to be able to do something like this:
 
str <- .C("return_foo_string", str=character(1))$str
 
void return_foo_string(char ** str) {
    *str = "foo";
}
 
The above code has at least two memory allocation "concerns": 
1) How to properly allocate "foo". I should probably use R_alloc, e.g.
 
char foo[] = "foo";
*str = R_alloc(sizeof(foo), 1);
 
2) I don't know if the string pointed to by *str before the
re-assignment, which now becomes dangling, will be properly reclaimed.
 
Thanks,
Vadim

        [[alternative HTML version deleted]]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to