From 8e1c15f6e2bbd99f63001739bcccd18d523e1ec5 Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Sat, 20 Dec 2025 20:26:05 +0000 Subject: [PATCH] [make] Enable -fvisibility=hidden This prevents symbols being exported by default, potentially resulting in more optimal code with a reduced binary size. This also matches msvc behaviour. --- Makefile | 2 +- src/luasimdjson.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0cb6217..d7b3af3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ OBJ = src/luasimdjson.o src/simdjson.o CPPFLAGS = -I$(LUA_INCDIR) -CXXFLAGS = -std=c++11 -Wall $(CFLAGS) +CXXFLAGS = -std=c++11 -Wall -fvisibility=hidden $(CFLAGS) LDFLAGS = $(LIBFLAG) LDLIBS = -lpthread diff --git a/src/luasimdjson.h b/src/luasimdjson.h index e9203ae..7f92718 100644 --- a/src/luasimdjson.h +++ b/src/luasimdjson.h @@ -3,7 +3,7 @@ #ifdef _MSC_VER #define LUASIMDJSON_EXPORT __declspec(dllexport) #else -#define LUASIMDJSON_EXPORT extern +#define LUASIMDJSON_EXPORT __attribute__((visibility("default"))) #endif extern "C" { @@ -23,4 +23,4 @@ extern "C" { {NULL, NULL}, }; LUASIMDJSON_EXPORT int luaopen_simdjson(lua_State*); -} \ No newline at end of file +}