From c1b11da985869610df24881c7911ad288bc680d3 Mon Sep 17 00:00:00 2001 From: Renato Rotenberg Date: Tue, 28 Jan 2025 22:57:13 -0300 Subject: [PATCH] Only expose public functions in GNU compiler builds if `SM64_LIB_EXPORT` is defined. This is useful for WebAssembly builds, since `libsm64` is built as a static library and the final linked `.wasm` file might not want to expose the `libsm64` functions. --- src/libsm64.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libsm64.h b/src/libsm64.h index c678587..6a59887 100644 --- a/src/libsm64.h +++ b/src/libsm64.h @@ -12,7 +12,11 @@ #define SM64_LIB_FN __declspec(dllimport) #endif #elif defined(__GNUC__) && __GNUC__ >= 4 - #define SM64_LIB_FN __attribute__ ((visibility("default"))) + #ifdef SM64_LIB_EXPORT + #define SM64_LIB_FN __attribute__ ((visibility("default"))) + #else + #define SM64_LIB_FN + #endif #else #define SM64_LIB_FN #endif