bug in dlopen(3) man page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

There is a bug in dlopen(3). The NOTES section claims:

"The symbols RTLD_DEFAULT and RTLD_NEXT are defined by <dlfcn.h> only
when _GNU_SOURCE was defined before including it."

However, this is not correct.

>From dlfcn.h on a "Gentoo Base System release 2.1":
#ifdef __USE_GNU
...
# define RTLD_NEXT      ((void *) -1l)
...
# define RTLD_DEFAULT   ((void *) 0)
...

You can verify this by compiling the attached program. For me it gives:
test.c: In function `main':
test.c:8: error: `RTLD_NEXT' undeclared (first use in this function)
test.c:8: error: (Each undeclared identifier is reported only once
test.c:8: error: for each function it appears in.)

It works if I set "__USE_GNU_" instead.

Please also check the "Glibc extensions: dladdr() and dlvsym()"
section, it also mentions _GNU_SOURCE.
 Thomas
#include <stdio.h>
#include <stdlib.h>

#define _GNU_SOURCE
#include <dlfcn.h>

int main(int argc, char *argv[]) {
	printf ("RTLD_NEXT is %d\n", RTLD_NEXT);
	exit(0);
}

[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux