From 1fa551fa49fb24b7ae2f8597109d7dd58147d6f9 Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Sat, 24 Aug 2024 16:52:21 -0400 Subject: [PATCH] Set `extern "C" {` after all R headers have been included --- src/include/Rinternals.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/include/Rinternals.h b/src/include/Rinternals.h index 517376b19aa..05dd434a2c7 100644 --- a/src/include/Rinternals.h +++ b/src/include/Rinternals.h @@ -34,7 +34,6 @@ # include # include # include -extern "C" { #else # include # include /* for INT_MAX */ @@ -52,18 +51,23 @@ extern "C" { #include -typedef unsigned char Rbyte; - -/* type for length of (standard, not long) vectors etc */ -typedef int R_len_t; -#define R_LEN_T_MAX INT_MAX - /* both config.h and Rconfig.h set SIZEOF_SIZE_T, but Rconfig.h is skipped if config.h has already been included. */ #ifndef R_CONFIG_H # include #endif +/* after all R headers */ +#ifdef __cplusplus +extern "C" { +#endif + +typedef unsigned char Rbyte; + +/* type for length of (standard, not long) vectors etc */ +typedef int R_len_t; +#define R_LEN_T_MAX INT_MAX + #if ( SIZEOF_SIZE_T > 4 ) # define LONG_VECTOR_SUPPORT #endif