Skip to content

Commit ee12e30

Browse files
committed
Add debugging message when in debug mode.
1 parent 4b8632b commit ee12e30

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/loaders/dyn_load.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
#include "dyn_load.h"
22

3-
#ifdef __unix__
3+
#if defined(__unix__) || defined(__APPLE__)
44

55
#include <dlfcn.h>
6+
#include <stddef.h>
7+
#include <err.h>
68

79
void *ga_load_library(const char *name) {
8-
return dlopen(name, RTLD_LAZY|RTLD_LOCAL);
10+
void *res = dlopen(name, RTLD_LAZY|RTLD_LOCAL);
11+
#ifdef DEBUG
12+
if (res == NULL)
13+
warn("dlopen: %s", name);
14+
#endif
15+
return res;
916
}
1017

1118
void *ga_func_ptr(void *h, const char *name) {
12-
return dlsym(h, name);
19+
void *res = dlsym(h, name);
20+
#ifdef DEBUG
21+
if (res == NULL)
22+
warn("dlsym: %s", name);
23+
#endif
24+
return res;
1325
}
1426

1527
#else

0 commit comments

Comments
 (0)