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 load
16 is found in the library itself. The library can have any recognized
17 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
28 EACCES The library specified by library does not have read or execute
29 permission, or the caller does not have search permission for
30 one of the directories in the path prefix. (See also path_reso‐
31 lution(2).)
32
33 ENFILE The system limit on the total number of open files has been
34 reached.
35
36 ENOEXEC
37 The file specified by library is not an executable of known
38 type, e.g., does not have the correct magic numbers.
39
41 uselib() is Linux specific, and should not be used in programs intended
42 to be portable.
43
45 uselib() was used by early libc startup code to load the shared
46 libraries with names found in an array of names in the binary.
47
48 Since libc 4.3.2, startup code tries to prefix these names with
49 "/usr/lib", "/lib" and "" before giving up. In libc 4.3.4 and later
50 these names are looked for in the directories found in LD_LIBRARY_PATH,
51 and if not found there, prefixes "/usr/lib", "/lib" and "/" are tried.
52
53 From libc 4.4.4 on only the library "/lib/ld.so" is loaded, so that
54 this dynamic library can load the remaining libraries needed (again
55 using this call). This is also the state of affairs in libc5.
56
57 glibc2 does not use this call.
58
60 ar(1), gcc(1), ld(1), ldd(1), mmap(2), open(2), dlopen(3), capabil‐
61 ity(7), ld.so(8)
62
63
64
65Linux 2.6.10 2005-01-09 USELIB(2)