Re: [Rd] Detecting compilation under R

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu 14 Dec 2006 - 17:23:01 GMT

On Thu, 14 Dec 2006, Barry Rowlingson wrote:

[Silently discarding the answer to his question, and breaching 'fair use' copyright provisions.]

>> So the problem is that you needed rather
>>
>> #include <R.h>
>> #ifdef USING_R
>> x = rand_unif(0.0,1.0);
>> #else
>> #include <gsl_random.h>
>> x = gsl_runif(0.0,1.0);
>> #endif
>>
>> since if R.h is not around, the include will not include it.

> If R.h is not around, the preprocessor will throw a tantrum:

If *no* R.h is around: easy to solve.

> cc -c -o simple.o simple.c
> simple.c:2:15: error: R.h: No such file or directory
>
> - all of which would be solved if SHLIB and BUILD set a preprocessor flag to
> indicate compilation by R.

What is BUILD?

> I dont see what use USING_R is. If you #include <R.h> you get it, but then
> you know you're USING_R because you included R.h, hence USING_R is going to
> always be defined in that code (unless the inclusion of R.h is conditional on
> something else...).
>
> Oh but of course I've missed something... Just tell me what...

You've clipped it from my previous mail, with no indication. As the posting guide points out, this is reprehensible.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri Dec 15 18:12:31 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 20 Dec 2006 - 08:31:03 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.