File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,14 +143,19 @@ static struct {
143143
144144
145145/*HDF5 variables*/
146- #define DEF_DEFAULT_BOOL_VARIABLE (NAME )\
147- _Bool NAME = -1
146+ #define DEF_DEFAULT_BOOL_VARIABLE (NAME , value )\
147+ _Bool NAME = value
148148
149149#define DEF_DLSYM_BOOL_VARIABLE (NAME )\
150- NAME = *((_Bool *)dlsym(handle, #NAME))
150+ {\
151+ void * symbol = dlsym(handle, #NAME);\
152+ if (symbol != NULL) {\
153+ NAME = *((_Bool *)symbol);\
154+ }\
155+ }
151156
152- DEF_DEFAULT_BOOL_VARIABLE (H5_libinit_g );
153- DEF_DEFAULT_BOOL_VARIABLE (H5_libterm_g );
157+ DEF_DEFAULT_BOOL_VARIABLE (H5_libinit_g , true );
158+ DEF_DEFAULT_BOOL_VARIABLE (H5_libterm_g , false );
154159
155160#define DEF_DEFAULT_VARIABLE (NAME )\
156161 hid_t NAME = -1
@@ -239,8 +244,8 @@ int init_filter(const char* libname)
239244 DL_H5Functions .H5Zunregister = (DL_func_H5Zunregister )dlsym (handle , "H5Zunregister" );
240245
241246 /*Variables*/
242- DEF_DLSYM_BOOL_VARIABLE (H5_libinit_g );
243- DEF_DLSYM_BOOL_VARIABLE (H5_libterm_g );
247+ DEF_DLSYM_BOOL_VARIABLE (H5_libinit_g )
248+ DEF_DLSYM_BOOL_VARIABLE (H5_libterm_g )
244249
245250 DEF_DLSYM_VARIABLE (H5E_ARGS_g );
246251 DEF_DLSYM_VARIABLE (H5E_BADTYPE_g );
You can’t perform that action at this time.
0 commit comments