From 10fa5118034f44430a6c44d51c740573f05c3933 Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Wed, 31 Jul 2024 23:48:20 -0500 Subject: [PATCH 1/2] ifdef does not work to detect function declarations --- r/src/arrow_cpp11.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/src/arrow_cpp11.h b/r/src/arrow_cpp11.h index 073b577d63a..080c26b5ece 100644 --- a/r/src/arrow_cpp11.h +++ b/r/src/arrow_cpp11.h @@ -389,7 +389,7 @@ SEXP to_r6(const std::shared_ptr& ptr, const char* r6_class_name) { // R_existsVarInFrame doesn't exist before R 4.2, so we need to fall back to // Rf_findVarInFrame3 if it is not defined. -#ifdef R_existsVarInFrame +#if (R_VERSION >= R_Version(4, 2, 0)) if (!R_existsVarInFrame(arrow::r::ns::arrow, r6_class)) { cpp11::stop("No arrow R6 class named '%s'", r6_class_name); } From 8a082f536a9540f484cde3973f04bee41af4206d Mon Sep 17 00:00:00 2001 From: Jonathan Keane Date: Thu, 1 Aug 2024 09:09:15 -0500 Subject: [PATCH 2/2] Update r/src/arrow_cpp11.h Co-authored-by: Neal Richardson --- r/src/arrow_cpp11.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/src/arrow_cpp11.h b/r/src/arrow_cpp11.h index 080c26b5ece..c4483ce531f 100644 --- a/r/src/arrow_cpp11.h +++ b/r/src/arrow_cpp11.h @@ -389,7 +389,7 @@ SEXP to_r6(const std::shared_ptr& ptr, const char* r6_class_name) { // R_existsVarInFrame doesn't exist before R 4.2, so we need to fall back to // Rf_findVarInFrame3 if it is not defined. -#if (R_VERSION >= R_Version(4, 2, 0)) +#if R_VERSION >= R_Version(4, 2, 0) if (!R_existsVarInFrame(arrow::r::ns::arrow, r6_class)) { cpp11::stop("No arrow R6 class named '%s'", r6_class_name); }