Skip to content
Draft
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
11 changes: 4 additions & 7 deletions src/gl/shim.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdio.h>
#include <stdint.h>
#include "gl.h"
#include "mesa/util/macros.h"
#include "real_dlsym.h"
#include <string.h>
#include <stdbool.h>
Expand Down Expand Up @@ -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__); \
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -312,6 +313,7 @@ if is_unixy
dependencies : [
dep_dl
],
gnu_symbol_visibility : 'hidden',
include_directories : [inc_common],
install_dir : libdir_mangohud,
install: true
Expand Down
4 changes: 2 additions & 2 deletions src/real_dlsym.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down