Skip to content

Commit

Permalink
Specify explicitly only the needed symbols to export from the DLL. Th…
Browse files Browse the repository at this point in the history
…is 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.
  • Loading branch information
kalibera committed Feb 17, 2024
1 parent ea74bc7 commit de029ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
10 changes: 9 additions & 1 deletion src/rstanarm-win.def
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit de029ca

Please sign in to comment.