aboutsummaryrefslogtreecommitdiff
path: root/src/disp.c
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-30 17:00:48 +0900
committerTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-30 17:00:48 +0900
commitc48f0176412f2c15fbb3cbc6052550959f581da9 (patch)
tree8d637080281f0b50f3a303e5a62ccb44e2201b21 /src/disp.c
parent46e6de294243e8dc593551bfe8c0e7090d03a159 (diff)
Add support for release compilation modeHEADmaster
Displays are not shared libraries, but object files that are part of the final executable.
Diffstat (limited to 'src/disp.c')
-rw-r--r--src/disp.c23
1 files changed, 20 insertions, 3 deletions
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