From de029caacacf688ec62bfb6c59d2a639e63fc57b Mon Sep 17 00:00:00 2001 From: Tomas Kalibera Date: Sat, 17 Feb 2024 17:21:36 +0100 Subject: [PATCH] Specify explicitly only the needed symbols to export from the DLL. This is safer wrt to possible naming conflicts and fixes linking on Windows using gcc 13.2, which produces weak symbols, which in turn cannot be exported from the DLL. Fix R_init_rstanarm to be found by R. --- src/init.cpp | 10 ++++++---- src/rstanarm-win.def | 10 +++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 108ef3a50..371db46a1 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -32,8 +32,10 @@ static const R_CallMethodDef CallEntries[] = { {NULL, NULL, 0} }; -void attribute_visible R_init_rstanarm(DllInfo *dll) { - // next line is necessary to avoid a NOTE from R CMD check - R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); - R_useDynamicSymbols(dll, TRUE); // necessary for .onLoad() to work +extern "C" { + void attribute_visible R_init_rstanarm(DllInfo *dll) { + // next line is necessary to avoid a NOTE from R CMD check + R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); + R_useDynamicSymbols(dll, TRUE); // necessary for .onLoad() to work + } } diff --git a/src/rstanarm-win.def b/src/rstanarm-win.def index 9ee9b6c97..5de99cae8 100644 --- a/src/rstanarm-win.def +++ b/src/rstanarm-win.def @@ -1,3 +1,11 @@ LIBRARY rstanarm.dll EXPORTS - + R_init_rstanarm + _rcpp_module_boot_stan_fit4bernoulli_mod + _rcpp_module_boot_stan_fit4binomial_mod + _rcpp_module_boot_stan_fit4continuous_mod + _rcpp_module_boot_stan_fit4count_mod + _rcpp_module_boot_stan_fit4jm_mod + _rcpp_module_boot_stan_fit4lm_mod + _rcpp_module_boot_stan_fit4mvmer_mod + _rcpp_module_boot_stan_fit4polr_mod