[Rd] Effect of the R framework on ctype.c

Sylvain Loiseau sylvain.loiseau at univ-paris13.fr
Mon Oct 8 16:11:48 CEST 2012

Dear all,

I'm facing a strange behavior in the the C code of a R package. This package, "rcqp", is a wrapper on an existing program that I did not write, "CWB".

In this package, on a linux (ubuntu and debian) system, the code :
     printf(%d\n", isupper('A'));
outputs :
When compiled with the R framework (It behaves correctly when CWB is compiled as a standalone program).

On mac osx, the code produce the expected output.

This unexpected output is observed only in the context of CWB compiled through rcqp, only on linux (not mac osx), and only under certains circumstances, since a minimal R package produce the expected output. Even in CWB, this strange behavior is not observed in any part of the code.

When observed, a work-around for this problem is to remove the include in which this very function, isupper, is defined:
    #include <ctype.h>

Since the program is compiled and run correctly without this "include", isupper() seems to be also declared elsewhere or ctype to be found by another mechanism, and the problem seems be due to interactions between the R headers (?) and the include of the CWB code…

Have you already observed such an effect or do you have any hint?

Sylvain Loiseau
sylvain.loiseau at univ-paris13.fr

Université Paris 13-Nord
Laboratoire Lexiques, Dictionnaires, Informatique
(UMR 7187 CNRS/Université Paris 13-Nord)
99 avenue Jean-Baptiste Clément
F-93410 Villetaneuse

More information about the R-devel mailing list