Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'RTLD_NEXT' undeclared

I'm trying to compile a C program but I get the error 'RTLD_NEXT' undeclared. I think this is supposed to be defined in dlfcn.h which the c program includes, but when I looked inside dlfcn.h there is no RTLD_NEXT.

How do I fix this?

like image 292
neuromancer Avatar asked Nov 22 '09 01:11

neuromancer


2 Answers

The issue here is that RTLD_NEXT is not defined by the posix standard . So the GNU people don't enable it unless you #define _GNU_SOURCE or -D_GNU_SOURCE.

Other relevant pieces of POSIX are dlfcn.h and dlsym.h. Interestingly, the later mentions RTLD_NEXT. Apparently, the GNU people are a bit confused about what is an extension and what is not.

like image 54
bmargulies Avatar answered Oct 10 '22 04:10

bmargulies


According to man dlsym it is #define _GNU_SOURCE (just one leading underscore) before the dlfcn.h is included. (RHEL6.1).

like image 21
Martin Avatar answered Oct 10 '22 03:10

Martin