Skip to content
Back to formatted view

Raw Message

Message-ID: <16c3b09f-031b-5dce-643d-d292894481b5@IEEE.org>
Date: 2020-10-14T19:56:40Z
From: Joseph Park
Subject: [R-pkg-devel] C++ library USING_R

Dear R-devel,

The Writing R Extensions manual states:

6.14 Platform and version information
The header files define USING_R, which can be used to test if the code 
is indeed being used with R.

I suppose this only applies to building R itself?? Or, perhaps when Rcpp 
is used for the interface, or if one includes R headers explicitly.

I have a C++ library that is built with no R-dependencies, then wrapped 
with an Rcpp interface. This same library is wrapped with pybind11 in 
the Python world, and directly used in C++ applications.

How can the C++ library code "know" that it's R building the library? Is 
there a platform-independent environment variable or macro?

Thanks.