diff --git a/src/gl/shim.c b/src/gl/shim.c index 98b61e9d56..0ca8b0754d 100644 --- a/src/gl/shim.c +++ b/src/gl/shim.c @@ -4,6 +4,7 @@ #include #include #include "gl.h" +#include "mesa/util/macros.h" #include "real_dlsym.h" #include #include @@ -131,13 +132,13 @@ static void loadMangoHud() { } #define CREATE_FWD_VOID(name, params, ...) \ - void name params { \ + PUBLIC void name params { \ loadMangoHud(); \ void (*p##name) params = real_dlsym(handle, #name); \ if (p##name) p##name(__VA_ARGS__); \ } #define CREATE_FWD(ret_type, name, params, ...) \ - ret_type name params { \ + PUBLIC ret_type name params { \ loadMangoHud(); \ ret_type (*p##name) params = real_dlsym(handle, #name); \ if (p##name) return p##name(__VA_ARGS__); \ @@ -181,11 +182,7 @@ static struct func_ptr hooks[] = { }; #undef ADD_HOOK -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(arr) sizeof(arr)/sizeof(arr[0]) -#endif - -void* dlsym(void *handle, const char *name) +PUBLIC void* dlsym(void *handle, const char *name) { const char* dlsym_enabled = getenv("MANGOHUD_DLSYM"); void* is_angle = real_dlsym(handle, "eglStreamPostD3DTextureANGLE"); diff --git a/src/meson.build b/src/meson.build index 99f8822ecf..99558bcf98 100644 --- a/src/meson.build +++ b/src/meson.build @@ -248,6 +248,7 @@ mangohud_opengl_shared_lib = shared_library( dep_vulkan, windows_deps, implot_dep], + gnu_symbol_visibility : 'hidden', include_directories : [inc_common], link_args : link_args, link_with: mangohud_static_lib, @@ -312,6 +313,7 @@ if is_unixy dependencies : [ dep_dl ], + gnu_symbol_visibility : 'hidden', include_directories : [inc_common], install_dir : libdir_mangohud, install: true diff --git a/src/real_dlsym.c b/src/real_dlsym.c index 8a45853707..4451e35b99 100644 --- a/src/real_dlsym.c +++ b/src/real_dlsym.c @@ -11,8 +11,8 @@ #include "real_dlsym.h" #include "elfhacks.h" -void *(*__dlopen)(const char *, int) = NULL; -void *(*__dlsym)(void *, const char *) = NULL; +static void *(*__dlopen)(const char *, int) = NULL; +static void *(*__dlsym)(void *, const char *) = NULL; static bool print_dlopen; static bool print_dlsym;