1USELIB(2) Linux Programmer's Manual USELIB(2)
2
3
4
6 uselib - load shared library
7
9 #include <unistd.h>
10
11 int uselib(const char *library);
12
14 The system call uselib() serves to load a shared library to be used by
15 the calling process. It is given a pathname. The address where to
16 load is found in the library itself. The library can have any recog‐
17 nized binary format.
18
20 On success, zero is returned. On error, -1 is returned, and errno is
21 set appropriately.
22
24 In addition to all of the error codes returned by open(2) and mmap(2),
25 the following may also be returned:
26
27 EACCES The library specified by library does not have read or execute
28 permission, or the caller does not have search permission for
29 one of the directories in the path prefix. (See also path_reso‐
30 lution(7).)
31
32 ENFILE The system limit on the total number of open files has been
33 reached.
34
35 ENOEXEC
36 The file specified by library is not an executable of known
37 type, e.g., does not have the correct magic numbers.
38
40 uselib() is Linux-specific, and should not be used in programs intended
41 to be portable.
42
44 uselib() was used by early libc startup code to load the shared
45 libraries with names found in an array of names in the binary.
46
47 Since libc 4.3.2, startup code tries to prefix these names with
48 "/usr/lib", "/lib" and "" before giving up. In libc 4.3.4 and later
49 these names are looked for in the directories found in LD_LIBRARY_PATH,
50 and if not found there, prefixes "/usr/lib", "/lib" and "/" are tried.
51
52 From libc 4.4.4 on only the library "/lib/ld.so" is loaded, so that
53 this dynamic library can load the remaining libraries needed (again
54 using this call). This is also the state of affairs in libc5.
55
56 glibc2 does not use this call.
57
59 ar(1), gcc(1), ld(1), ldd(1), mmap(2), open(2), dlopen(3), capabili‐
60 ties(7), ld.so(8)
61
63 This page is part of release 3.53 of the Linux man-pages project. A
64 description of the project, and information about reporting bugs, can
65 be found at http://www.kernel.org/doc/man-pages/.
66
67
68
69Linux 2005-01-09 USELIB(2)