From c48f0176412f2c15fbb3cbc6052550959f581da9 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Sun, 30 Jun 2024 17:00:48 +0900 Subject: Add support for release compilation mode Displays are not shared libraries, but object files that are part of the final executable. --- src/disp.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src/disp.c') diff --git a/src/disp.c b/src/disp.c index 8a1a174..26bb2f2 100644 --- a/src/disp.c +++ b/src/disp.c @@ -25,6 +25,13 @@ #include "disp.h" +#ifdef NDEBUG +extern struct disp *cli_disp; +extern struct disp *tui_disp; +extern struct disp *ray_disp; +#endif + +#ifndef NDEBUG static void * load_generic_symbol(struct disp *disp, char *base_name) { @@ -46,8 +53,9 @@ load_generic_symbol(struct disp *disp, char *base_name) return ptr; } +#endif - +#ifndef NDEBUG static void load_symbols(struct disp *disp) { @@ -72,6 +80,7 @@ load_symbols(struct disp *disp) printf("INFO: successfully loaded symbols from \"%s\"\n", disp->so_path); } +#endif struct disp * get_disp(char *disp_name) @@ -90,9 +99,15 @@ get_disp(char *disp_name) return disp; #else -# error "not available yet" -#endif + if (strcmp(disp_name, "cli") == 0) + return cli_disp; + if (strcmp(disp_name, "tui") == 0) + return tui_disp; + if (strcmp(disp_name, "ray") == 0) + return ray_disp; + return NULL; +#endif } void @@ -101,11 +116,13 @@ destroy_disp(struct disp *disp) if (disp->destroy) disp->destroy(); +#ifndef NDEBUG if (disp->dl_handle) dlclose(disp->dl_handle); free(disp->so_path); free(disp); +#endif } #ifndef NDEBUG -- cgit v1.2.3