From sylvain.loiseau at univ-paris13.fr  Mon Oct  8 16:11:48 2012
From: sylvain.loiseau at univ-paris13.fr (Sylvain Loiseau)
Date: Mon, 8 Oct 2012 16:11:48 +0200
Subject: [Rd] Effect of the R framework on ctype.c
Message-ID: <F6DDF0FF-58EB-4D94-97A5-2E290BA4A48F@univ-paris13.fr>

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 :
    0
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?
Best,
Sylvain


-----
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



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