From b.rowlingson at lancaster.ac.uk  Thu Dec 14 18:13:54 2006
From: b.rowlingson at lancaster.ac.uk (Barry Rowlingson)
Date: Thu, 14 Dec 2006 17:13:54 +0000
Subject: [Rd] Detecting compilation under R
In-Reply-To: <Pine.LNX.4.64.0612141618580.29210@gannet.stats.ox.ac.uk>
References: <45816A65.8000802@lancaster.ac.uk>
	<Pine.LNX.4.64.0612141618580.29210@gannet.stats.ox.ac.uk>
Message-ID: <45818652.7050102@lancaster.ac.uk>


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

  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.

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

Barry



[Rd] Detecting compilation under R
Barry Rowlingson