From da0bd64372163b4cd6fad3433fc1ab7f668ea9ef Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Thu, 17 Nov 2022 16:42:15 +0100 Subject: [PATCH 1/2] Support hidden visibility --- src/Makevars | 1 + src/init.c | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 src/Makevars diff --git a/src/Makevars b/src/Makevars new file mode 100644 index 00000000..bf5eb423 --- /dev/null +++ b/src/Makevars @@ -0,0 +1 @@ +PKG_CFLAGS = $(C_VISIBILITY) diff --git a/src/init.c b/src/init.c index c43e4625..3f4c51fb 100644 --- a/src/init.c +++ b/src/init.c @@ -3,6 +3,11 @@ #include #include // for NULL +// Compile with `C_VISIBILITY = -fvisibility=hidden` if you link to +// this library +#include +#define export attribute_visible extern + /* .Call calls */ extern SEXP glue_(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP); extern SEXP trim_(SEXP); @@ -12,6 +17,7 @@ static const R_CallMethodDef CallEntries[] = { {"trim_", (DL_FUNC)&trim_, 1}, {NULL, NULL, 0}}; +export void R_init_glue(DllInfo* dll) { R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); R_useDynamicSymbols(dll, FALSE); From fa94a58ccd42be1c4af55e5b0391d199f6aa988f Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Fri, 18 Nov 2022 08:41:49 -0800 Subject: [PATCH 2/2] Add NEWS bullet --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index bc7b59e2..374d5a01 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # glue (development version) +* Add `$(C_VISIBILITY)` to compiler flags to hide internal symbols from the dll (#284 @lionel-). + # glue 1.6.2 * Modify a test for better forward compatibility with R.