Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support hidden visibility for compatibility with webR #284

Merged
merged 2 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PKG_CFLAGS = $(C_VISIBILITY)
6 changes: 6 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
#include <Rinternals.h>
#include <stdlib.h> // for NULL

// Compile with `C_VISIBILITY = -fvisibility=hidden` if you link to
// this library
#include <R_ext/Visibility.h>
#define export attribute_visible extern

/* .Call calls */
extern SEXP glue_(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP trim_(SEXP);
Expand All @@ -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);
Expand Down