#1146 Strings not working for R versions > 2.7.0

closed-accepted
r (7)
5
2011-03-29
2011-03-24
Marie White
No

Small issue. In rfragments.swg:

#if R_VERSION >= R_Version(2,7,0)
c = Rf_mkCharLen(carray, size);
#else
c = Rf_allocVector(CHARSXP, size);
strncpy((char *)CHAR(c), carray, size);
#endif

The preprocessor commands don't get included in the wrapper file. Adding % in front of the preprocessors seems to fix it:

%#if R_VERSION >= R_Version(2,7,0)
c = Rf_mkCharLen(carray, size);
%#else
c = Rf_allocVector(CHARSXP, size);
strncpy((char *)CHAR(c), carray, size);
%#endif

Discussion

  • Marie White
    Marie White
    2011-03-24

    • assigned_to: drjoe --> wsfulton
     
  • William Fulton
    William Fulton
    2011-03-29

    • status: open --> closed-accepted
     
  • William Fulton
    William Fulton
    2011-03-29

    Thanks for the patch. Committed to trunk for swig-2.0.3.