From 52b3d99b880e7a0031337f86a34094d116c768f0 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Sat, 22 Jun 2024 15:00:03 +0900 Subject: Add dynamix reloading functions Also reserve a couple return values for read_input. --- src/disp.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/disp.c') 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 +#include #include #include #include @@ -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 -- cgit v1.2.3