From c38882ffa3f87c3bbc0c0735f915b94ba9e09260 Mon Sep 17 00:00:00 2001 From: perrydv Date: Wed, 10 Dec 2025 18:35:30 +0100 Subject: [PATCH] try setting R6interface parent_env to the uncompiled parent_env with an extra layer --- nCompiler/R/NC_FullCompiledInterface.R | 2 +- nCompiler/R/nCompile.R | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nCompiler/R/NC_FullCompiledInterface.R b/nCompiler/R/NC_FullCompiledInterface.R index 7fb48302..7dda331b 100644 --- a/nCompiler/R/NC_FullCompiledInterface.R +++ b/nCompiler/R/NC_FullCompiledInterface.R @@ -55,7 +55,7 @@ #' @export build_compiled_nClass <- function(NCgenerator, newCobjFun, - env = parent.frame(), + env = NCgenerator$parent_env, quoted = FALSE) { # One might wonder if we can have an R6 class created here to # interface with a compiled C++ class be established with diff --git a/nCompiler/R/nCompile.R b/nCompiler/R/nCompile.R index 95ec03ba..ac85b41e 100644 --- a/nCompiler/R/nCompile.R +++ b/nCompiler/R/nCompile.R @@ -670,8 +670,8 @@ nCompile_finish_nonpackage <- function(units, } else { if(expect_createFromR[i]) createFromR_fun <- compiledFuns[[iRes]] R6interfaces[[i]] <- try(build_compiled_nClass(units[[i]], - createFromR_fun, - env = resultEnv)) + createFromR_fun)) + # env = resultEnv)) if(inherits(R6interfaces[[i]], "try-error")) { warning(paste0("There was a problem building a full nClass interface for ", exportNames[i], ".")) R6interfaces[[i]] <- NULL