>>>>> "Fernando" == Fernando Pineda <[EMAIL PROTECTED]> >>>>> on Wed, 2 Jun 2004 23:22:22 -0400 writes:
Fernando> I'm using .C() and .External() and have no Fernando> problems sending integers, reals or strings from R Fernando> to C. Nor do I have problems sending integers or Fernando> reals back from C to R. But I'm pulling my hair Fernando> out trying to set a string value in a C function Fernando> and then sending it back from C to to R. I've Fernando> searched the usual sources and tried various Fernando> casts, macros and allocation schemes, but I'm Fernando> failing miserably. Could someone please put me out Fernando> of my misery and point me to a working example? You did read the section entitled "Interface functions `.C' and `.Fortran'" in the "Writing R Extensions" manual ? In particular, >> The following table gives the mapping between the modes of R vectors >> and the types of arguments to a C function or FORTRAN subroutine. >> >> R storage mode C type FORTRAN type >> `logical' `int *' `INTEGER' >> `integer' `int *' `INTEGER' >> `double' `double *' `DOUBLE PRECISION' >> `complex' `Rcomplex *' `DOUBLE COMPLEX' >> `character' `char **' `CHARACTER*255' ?? One working example is the R function formatC() with the C code in <Rsource>/src/appl/strsignif.c Martin Maechler ______________________________________________ [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