I'm having a failure while passing a pointer nullto dlclose.
null
dlclose
Do I need to check for null before calling dlclose?
POSIX doesn't say anything about this: http://pubs.opengroup.org/onlinepubs/7908799/xsh/dlclose.html
Is this undefined behavior or an implementation error dlclose?
It's complicated. POSIX declares that
if handlenot related to an open object, dlclose()returns a nonzero value
handle
dlclose()
, , . Linux/Glibc, -, , NULL .
NULL
[ , Linux . libdl, POSIX .]
libdl
NULL, . , NULL, - ... .
malloc/free (1), . fopen/fclose (2), . , , , .
malloc
free
fopen
fclose
, , POSIX, .
I found https://stackoverflow.com/a/6277781/877329 from this answer , and then read man pthread_joinwhich you can call pthread_joinwith an invalid tid that supports.Another malloc/freeproblem I found with the dynamic loader interface is that It does not use a standard error handling system, but has its own function dlerror.
man pthread_join
pthread_join
malloc/free
dlerror