Get error from dln_open when USE_SHARED_GC

Before, if dln_open failed to open RUBY_GC_LIBRARY_PATH, it would segfault
because it would try to raise an error, which cannot happen because the
GC has not been initialized yet.

This commit changes dln_open to return the error that occurred so the
caller can handle the error.
This commit is contained in:
Peter Zhu 2024-04-23 14:30:31 -04:00
parent 81433fd0f5
commit b9109b270d
4 changed files with 22 additions and 26 deletions

2
dln.h
View file

@ -25,7 +25,7 @@ RUBY_SYMBOL_EXPORT_BEGIN
char *dln_find_exe_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
char *dln_find_file_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
void *dln_load(const char*);
void *dln_open(const char *file);
void *dln_open(const char *file, const char **error);
void *dln_symbol(void*,const char*);
RUBY_SYMBOL_EXPORT_END