R-beta: Characters in .C
Ross Ihaka (ihaka@stat.auckland.ac.nz)
Wed, 6 Aug 1997 15:11:40 +1200 (NZST)
Date: Wed, 6 Aug 1997 15:11:40 +1200 (NZST)
Message-Id: <199708060311.PAA14297@stat1.stat.auckland.ac.nz>
From: Ross Ihaka <ihaka@stat.auckland.ac.nz>
To: Ian Wilson <I.Wilson@qmw.ac.uk>
Subject: R-beta: Characters in .C
In-Reply-To: <21004.9708050954@laplace.maths.qmw.ac.uk>
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.
Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=