dependencies.cpp

main 29 lines · 860 bytes Raw
Alex Alex Commit Client Upload Part 2 19/10/2026 00:06
1#if (__ANDROID_API__ > 19)
2#include <android/api-level.h>
3#include <android/log.h>
4#include <signal.h>
5#include <dlfcn.h>
6
7extern "C" {
8 typedef __sighandler_t(*bsd_signal_func_t)(int, __sighandler_t);
9 bsd_signal_func_t bsd_signal_func = NULL;
10
11 __sighandler_t bsd_signal(int s, __sighandler_t f)
12 {
13 if (bsd_signal_func == NULL) {
14 // For now (up to Android 7.0) this is always available
15 bsd_signal_func = (bsd_signal_func_t)dlsym(RTLD_DEFAULT, "bsd_signal");
16
17 if (bsd_signal_func == NULL) {
18 // You may try dlsym(RTLD_DEFAULT, "signal") or dlsym(RTLD_NEXT, "signal") here
19 // Make sure you add a comment here in StackOverflow
20 // if you find a device that doesn't have "bsd_signal" in its libc.so!!!
21
22 __android_log_assert("", "bsd_signal_wrapper", "bsd_signal symbol not found!");
23 }
24 }
25
26 return bsd_signal_func(s, f);
27 }
28}
29#endif
Top