1USELIB(2)                  Linux Programmer's Manual                 USELIB(2)
2
3
4

NAME

6       uselib - load shared library
7

SYNOPSIS

9       #include <unistd.h>
10
11       int uselib(const char *library);
12
13       Note:  No declaration of this system call is provided in glibc headers;
14       see NOTES.
15

DESCRIPTION

17       The system call uselib() serves to load a shared library to be used  by
18       the  calling  process.   It  is given a pathname.  The address where to
19       load is found in the library itself.  The library can have  any  recog‐
20       nized binary format.
21

RETURN VALUE

23       On  success,  zero is returned.  On error, -1 is returned, and errno is
24       set appropriately.
25

ERRORS

27       In addition to all of the error codes returned by open(2) and  mmap(2),
28       the following may also be returned:
29
30       EACCES The  library  specified by library does not have read or execute
31              permission, or the caller does not have  search  permission  for
32              one of the directories in the path prefix.  (See also path_reso‐
33              lution(7).)
34
35       ENFILE The system-wide limit on the total number of open files has been
36              reached.
37
38       ENOEXEC
39              The  file  specified  by library is not an executable of a known
40              type; for example, it does not have the correct magic numbers.
41

CONFORMING TO

43       uselib() is Linux-specific, and should not be used in programs intended
44       to be portable.
45

NOTES

47       This obsolete system call is not supported by glibc.  No declaration is
48       provided in glibc headers, but, through a quirk of history, glibc  ver‐
49       sions  before  2.23 did export an ABI for this system call.  Therefore,
50       in order to employ this system call,  it  was  sufficient  to  manually
51       declare the interface in your code; alternatively, you could invoke the
52       system call using syscall(2).
53
54       In ancient  libc  versions,  uselib()  was  used  to  load  the  shared
55       libraries with names found in an array of names in the binary.
56
57       Since  libc  4.3.2,  startup  code  tries  to  prefix  these names with
58       "/usr/lib", "/lib" and "" before giving up.  In libc  4.3.4  and  later
59       these names are looked for in the directories found in LD_LIBRARY_PATH,
60       and if not found there, prefixes "/usr/lib", "/lib" and "/" are tried.
61
62       From libc 4.4.4 on only the library "/lib/ld.so"  is  loaded,  so  that
63       this  dynamic  library  can  load the remaining libraries needed (again
64       using this call).  This is also the state of affairs in libc5.
65
66       glibc2 does not use this call.
67
68       Since Linux 3.15, this system call is available only when the kernel is
69       configured with the CONFIG_USELIB option.
70

SEE ALSO

72       ar(1),  gcc(1),  ld(1),  ldd(1), mmap(2), open(2), dlopen(3), capabili‐
73       ties(7), ld.so(8)
74

COLOPHON

76       This page is part of release 5.04 of the Linux  man-pages  project.   A
77       description  of  the project, information about reporting bugs, and the
78       latest    version    of    this    page,    can     be     found     at
79       https://www.kernel.org/doc/man-pages/.
80
81
82
83Linux                             2017-09-15                         USELIB(2)
Impressum