diff options
| author | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-20 02:25:54 +0900 | 
|---|---|---|
| committer | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2024-06-20 02:25:54 +0900 | 
| commit | ec3f97394f0629ddc423ac7962b9cfa126c61662 (patch) | |
| tree | a28732c039af3f1bfbd8b2f5354bc4da472c8ef7 /src | |
| parent | 13e8df014fe59c0c941ea20c9ecad2dbeee3edf9 (diff) | |
Improve error handling
Diffstat (limited to 'src')
| -rw-r--r-- | src/disp.c | 9 | 
1 files changed, 7 insertions, 2 deletions
| @@ -18,12 +18,13 @@  #include <dlfcn.h>  #include <string.h> +#include <stdio.h>  #include <stdlib.h>  #include <assert.h>  #include "disp.h" -#define dlsym_and_check(dest, name)		\ +#define dlsym_and_check(dest, name)			\  	dest->name = dlsym(dest->dl_handle, #name);	\  	if (!dest->name) {				\  		dlclose(dest->dl_handle);		\ @@ -43,7 +44,11 @@ get_disp(char *disp_name)  	void *handle = dlopen(so_path, RTLD_LAZY);  	if (!handle) -		return NULL; +	{ +		char *msg = dlerror(); +		fprintf(stderr, "calculer: %s\n", msg); +		exit(1); +	}  	struct disp *disp = malloc(sizeof(*disp));  	disp->dl_handle = handle; | 
