Re: [Rd] function-like macros undefined

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Wed 16 Mar 2005 - 14:42:30 GMT

On Tue, 15 Mar 2005 18:58:32 -0800, "Vadim Ogranovich" <vograno@evafunds.com> wrote :

>Hi,
>
>Somehow function-like macros from Rinternals.h are not defined when I
>include the file.
>
>foo.c
>##################
>#include <R.h>
>#include <Rinternals.h>
>
>
>#ifndef NILSXP
>#error("NILSXP")
>#endif
>
>
>#ifndef INTEGER
>#error("INTEGER")
>#endif
>###################
>
>
>When compiled:
>vor/src% gcc -I/usr/local/lib/R/include -g -O2 -c foo.c -o foo.o
>foo.c:11:2: #error ("INTEGER")
>
>Note that NILSXP is defined. This is true for some other function-like
>macros, e.g. RAW()

The definition of INTEGER is wrapped in

#ifdef USE_RINTERNALS

and there's this comment in Defn.h:

/* To test the write barrier used by the generational collector,

   define TESTING_WRITE_BARRIER. This makes the internal structure of    SEXPRECs visible only inside of files that explicitly define    USE_RINTERNALS, and all uses of SEXPREC fields that do not go    through the appropriate functions or macros will become compilation    errors. Since this does impose a small but noticable performance    penalty, code that includes Defn.h (or code that explicitly defines    USE_RINTERNALS) can access a SEXPREC's fields directly. */

To read about the reasons for the write barrier, see

http://www.stat.uiowa.edu/~luke/R/barrier.html

Duncan Murdoch
>
>
>Did anyone come across such a problem?
>
>> version
> _
>platform x86_64-unknown-linux-gnu
>arch x86_64
>os linux-gnu
>system x86_64, linux-gnu
>status
>major 2
>minor 0.1
>year 2004
>month 11
>day 15
>language R
>
>
>OS: suse.9.2_64
>
>Note also that R doesn't recognize this is Suse, it says
>x86_64-unknown-linux-gnu. Hope this is not a problem.
>
>Thanks,
>Vadim
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-devel@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-devel



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Mar 17 01:52:17 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:26:30 GMT