Displaying 1 result from an estimated 1 matches for "checkstr_r_wrapper".
2009 Aug 28
1
Calling C funtion from R help Needed
...(char n,int m)
{
int result;
result = 3;
//result = strlen(n);
printf("the string is %c\n",n);
printf("the silly number is %d\n",m);
return result;
}
Wrapper Code (wrapcheckstr.c)
#include <stdio.h>
#include<string.h>
int n_char(char ,int );
void checkstr_R_wrapper(char *n,int *m, int *result)
{ *result = n_char(*n,*m); }
R code (checkstr.c)
checkstr <- function(n,m) {
if (!is.loaded(symbol.C('checkstr_R_wrapper'))) { dyn.load('checkstr.so') }
returned_data = .C('checkstr_R_wrapper', n=as.character(n),m=as.integer(m), result=inte...