Skip to content

Commit de029ca

Browse files
committed
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.
1 parent ea74bc7 commit de029ca

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/init.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ static const R_CallMethodDef CallEntries[] = {
3232
{NULL, NULL, 0}
3333
};
3434

35-
void attribute_visible R_init_rstanarm(DllInfo *dll) {
36-
// next line is necessary to avoid a NOTE from R CMD check
37-
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
38-
R_useDynamicSymbols(dll, TRUE); // necessary for .onLoad() to work
35+
extern "C" {
36+
void attribute_visible R_init_rstanarm(DllInfo *dll) {
37+
// next line is necessary to avoid a NOTE from R CMD check
38+
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
39+
R_useDynamicSymbols(dll, TRUE); // necessary for .onLoad() to work
40+
}
3941
}

src/rstanarm-win.def

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
LIBRARY rstanarm.dll
22
EXPORTS
3-
3+
R_init_rstanarm
4+
_rcpp_module_boot_stan_fit4bernoulli_mod
5+
_rcpp_module_boot_stan_fit4binomial_mod
6+
_rcpp_module_boot_stan_fit4continuous_mod
7+
_rcpp_module_boot_stan_fit4count_mod
8+
_rcpp_module_boot_stan_fit4jm_mod
9+
_rcpp_module_boot_stan_fit4lm_mod
10+
_rcpp_module_boot_stan_fit4mvmer_mod
11+
_rcpp_module_boot_stan_fit4polr_mod

0 commit comments

Comments
 (0)