R-beta: Characters in .C

Ross Ihaka ihaka at stat.auckland.ac.nz
Wed Aug 6 05:11:40 CEST 1997

Ian Wilson writes:
 > I am having some difficulties using dynamically loaded
 > C functions on a Sparc 10 with R compiled
 > using cc  (both R-0.49 and R-0.50).  I get sporadic errors with the 
 > error message:
 > Error: character variables must be duplicated in .C/.Fortran,
 > with C functions which pass character variables.
 > my C functions look like:  anyfunc(char **filename, other variables )
 > This error message appears about 25% of the time.
 > What is the problem ? 
This is an uninitialized variable problem.  The fix is as follows:

In the file RHOME/src/main/dotcode.c, find the function declaration
for "naoktrim" and make the change noted below.

static SEXP naoktrim(SEXP s, int * len, int *naok, int *dup)
        SEXP value;

        if(s == R_NilValue) {
                value = R_NilValue;
                *naok = 0;
                *dup = 0;	/* !!!! Add this line !!!! */
                *len = 0;

This will be in the next lot of patches we send out for 0.50.
Sorry 'bout that.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list