diff options
author | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-22 15:00:03 +0900 |
---|---|---|
committer | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-22 15:00:03 +0900 |
commit | 52b3d99b880e7a0031337f86a34094d116c768f0 (patch) | |
tree | f04b55e95ceee78a222576ea01f96c8488a5a077 /src | |
parent | 0a00398cb206809cc7770a26f8cf490db9e8bf5a (diff) |
Add dynamix reloading functions
Also reserve a couple return values for read_input.
Diffstat (limited to 'src')
-rw-r--r-- | src/disp.c | 9 | ||||
-rw-r--r-- | src/disp.h | 2 |
2 files changed, 11 insertions, 0 deletions
@@ -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 @@ -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. */ |