Re: [Rd] Detecting compilation under R

2006-12-19 Thread Paul Roebuck
On Thu, 14 Dec 2006, Prof Brian Ripley wrote: > 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 > >> #ifdef USING_R > >> x = rand_

Re: [Rd] Detecting compilation under R

2006-12-14 Thread Prof Brian Ripley
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 >> #ifdef USING_R >> x = rand_unif(0.0,1.0); >> #else >> #include >> x = gsl_runif(0.0,1.0);

Re: [Rd] Detecting compilation under R

2006-12-14 Thread Barry Rowlingson
> So the problem is that you needed rather > > #include > #ifdef USING_R > x = rand_unif(0.0,1.0); > #else > #include > 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

Re: [Rd] Detecting compilation under R

2006-12-14 Thread Prof Brian Ripley
On Thu, 14 Dec 2006, Barry Rowlingson wrote: > The docs tell me: > > "The header files define USING_R, which should be used to test if the > code is indeed being used with R." > > but surely you only get that if you #include , which you can only Nope, also if you include , which you can do under

Re: [Rd] Detecting compilation under R

2006-12-14 Thread Barry Rowlingson
Prof Brian Ripley wrote: > If *no* R.h is around: easy to solve. Have a dummy R.h somewhere? > What is BUILD? Oh, pardon me for forgetting the arbitrary capitalisation of R CMD thingies. Can someone come up with a mnemonic for remembering that BATCH, COMPILE, SHLIB, INSTALL, LINK and REMO