Skip to content

Commit f33fa32

Browse files
committed
Hide internal symbols from the DLL
1 parent 57f30e4 commit f33fa32

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Makevars.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
LIBDIR = myrustlib/target/release
22
STATLIB = $(LIBDIR)/libmyrustlib.a
3-
PKG_CFLAGS = -pthread
3+
PKG_CFLAGS = -pthread $(C_VISIBILITY)
44
PKG_LIBS = -L$(LIBDIR) -lmyrustlib -lresolv -pthread
55
CARGO = @cargobin@
66

src/wrapper.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#define R_NO_REMAP
22
#define STRICT_R_HEADERS
33
#include <Rinternals.h>
4+
#include <R_ext/Rdynload.h>
5+
#include <R_ext/Visibility.h>
46

57
// Import C headers for rust API
68
#include <pthread.h>
@@ -14,7 +16,7 @@ typedef struct {
1416
} gifski_encoder_thread_info;
1517

1618
/* gifski_write() blocks until main thread calls gifski_end_adding_frames() */
17-
void * gifski_encoder_thread(void * data){
19+
static void * gifski_encoder_thread(void * data){
1820
gifski_encoder_thread_info * info = data;
1921
info->err = gifski_write(info->g, info->path);
2022
return NULL;
@@ -74,7 +76,7 @@ static const R_CallMethodDef CallEntries[] = {
7476
{NULL, NULL, 0}
7577
};
7678

77-
void R_init_gifski(DllInfo *dll) {
79+
attribute_visible void R_init_gifski(DllInfo *dll) {
7880
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
7981
R_useDynamicSymbols(dll, FALSE);
8082
}

0 commit comments

Comments
 (0)