aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-22 15:00:03 +0900
committerTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-22 15:00:03 +0900
commit52b3d99b880e7a0031337f86a34094d116c768f0 (patch)
treef04b55e95ceee78a222576ea01f96c8488a5a077 /src
parent0a00398cb206809cc7770a26f8cf490db9e8bf5a (diff)
Add dynamix reloading functions
Also reserve a couple return values for read_input.
Diffstat (limited to 'src')
-rw-r--r--src/disp.c9
-rw-r--r--src/disp.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/disp.c b/src/disp.c
index 27f74e4..18b6168 100644
--- a/src/disp.c
+++ b/src/disp.c
@@ -17,6 +17,7 @@
#include "config.h"
#include <dlfcn.h>
+#include <limits.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -24,6 +25,10 @@
#include "disp.h"
+/* Reserved return values for the read_input function. */
+#define DISP_ERR INT_MAX
+#define DISP_RELOAD (INT_MAX - 1)
+
#define dlsym_and_check(dest, name) \
dest->name = dlsym(dest->dl_handle, #name); \
if ((!dest->name) || (dest->name == dest->dl_handle)) { \
@@ -52,6 +57,8 @@ get_disp(char *disp_name)
exit(1);
}
+ printf("INFO: successfully loaded symbols from \"%s\"\n", so_path);
+
struct disp *disp = malloc(sizeof(*disp));
disp->dl_handle = handle;
dlsym_and_check(disp, init);
@@ -59,6 +66,8 @@ get_disp(char *disp_name)
dlsym_and_check(disp, read_input);
dlsym_and_check(disp, display_res);
dlsym_and_check(disp, destroy);
+ dlsym_and_check(disp, pre_reload);
+ dlsym_and_check(disp, post_reload);
return disp;
#else
diff --git a/src/disp.h b/src/disp.h
index e011884..d0b2d19 100644
--- a/src/disp.h
+++ b/src/disp.h
@@ -30,6 +30,8 @@ struct disp {
int (*read_input)(void);
void (*display_res)(bool, int);
void (*destroy)(void);
+ void *(*pre_reload)(void);
+ void (*post_reload)(void *);
};
/* Get a display handler for the given display type. */