dlopen.3 (211397) | dlopen.3 (229768) |
---|---|
1.\" This source code is a product of Sun Microsystems, Inc. and is provided 2.\" for unrestricted use provided that this legend is included on all tape 3.\" media and as a part of the software program in whole or part. Users 4.\" may copy or modify this source code without charge, but are not authorized 5.\" to license or distribute it to anyone else except as part of a product or 6.\" program developed by the user. 7.\" 8.\" THIS PROGRAM CONTAINS SOURCE CODE COPYRIGHTED BY SUN MICROSYSTEMS, INC. --- 16 unchanged lines hidden (view full) --- 25.\" 26.\" Sun Microsystems, Inc. 27.\" 2550 Garcia Avenue 28.\" Mountain View, California 94043 29.\" 30.\" Copyright (c) 1991 Sun Microsystems, Inc. 31.\" 32.\" @(#) dlopen.3 1.6 90/01/31 SMI | 1.\" This source code is a product of Sun Microsystems, Inc. and is provided 2.\" for unrestricted use provided that this legend is included on all tape 3.\" media and as a part of the software program in whole or part. Users 4.\" may copy or modify this source code without charge, but are not authorized 5.\" to license or distribute it to anyone else except as part of a product or 6.\" program developed by the user. 7.\" 8.\" THIS PROGRAM CONTAINS SOURCE CODE COPYRIGHTED BY SUN MICROSYSTEMS, INC. --- 16 unchanged lines hidden (view full) --- 25.\" 26.\" Sun Microsystems, Inc. 27.\" 2550 Garcia Avenue 28.\" Mountain View, California 94043 29.\" 30.\" Copyright (c) 1991 Sun Microsystems, Inc. 31.\" 32.\" @(#) dlopen.3 1.6 90/01/31 SMI |
33.\" $FreeBSD: head/lib/libc/gen/dlopen.3 211397 2010-08-16 15:18:30Z joel $ | 33.\" $FreeBSD: head/lib/libc/gen/dlopen.3 229768 2012-01-07 10:33:01Z kib $ |
34.\" | 34.\" |
35.Dd July 7, 2009 | 35.Dd December 21, 2011 |
36.Dt DLOPEN 3 37.Os 38.Sh NAME 39.Nm dlopen , | 36.Dt DLOPEN 3 37.Os 38.Sh NAME 39.Nm dlopen , |
40.Nm fdlopen , |
|
40.Nm dlsym , 41.Nm dlfunc , 42.Nm dlerror , 43.Nm dlclose 44.Nd programmatic interface to the dynamic linker 45.Sh LIBRARY 46.Lb libc 47.Sh SYNOPSIS 48.In dlfcn.h 49.Ft void * 50.Fn dlopen "const char *path" "int mode" 51.Ft void * | 41.Nm dlsym , 42.Nm dlfunc , 43.Nm dlerror , 44.Nm dlclose 45.Nd programmatic interface to the dynamic linker 46.Sh LIBRARY 47.Lb libc 48.Sh SYNOPSIS 49.In dlfcn.h 50.Ft void * 51.Fn dlopen "const char *path" "int mode" 52.Ft void * |
53.Fn fdlopen "int fd" "int mode" 54.Ft void * |
|
52.Fn dlsym "void * restrict handle" "const char * restrict symbol" 53.Ft dlfunc_t 54.Fn dlfunc "void * restrict handle" "const char * restrict symbol" 55.Ft char * 56.Fn dlerror "void" 57.Ft int 58.Fn dlclose "void *handle" 59.Sh DESCRIPTION --- 99 unchanged lines hidden (view full) --- 159.Pp 160If 161.Fn dlopen 162fails, it returns a null pointer, and sets an error condition which may 163be interrogated with 164.Fn dlerror . 165.Pp 166The | 55.Fn dlsym "void * restrict handle" "const char * restrict symbol" 56.Ft dlfunc_t 57.Fn dlfunc "void * restrict handle" "const char * restrict symbol" 58.Ft char * 59.Fn dlerror "void" 60.Ft int 61.Fn dlclose "void *handle" 62.Sh DESCRIPTION --- 99 unchanged lines hidden (view full) --- 162.Pp 163If 164.Fn dlopen 165fails, it returns a null pointer, and sets an error condition which may 166be interrogated with 167.Fn dlerror . 168.Pp 169The |
170.Fn fdlopen 171function is similar to 172.Fn dlopen , 173but it takes the file descriptor argument 174.Fa fd , 175which is used for the file operations needed to load an object 176into the address space. 177The file descriptor 178.Fa fd 179is not closed by the function regardless a result of execution, 180but a duplicate of the file descriptor is. 181This may be important if a 182.Xr lockf 3 183lock is held on the passed descriptor. 184The 185.Fa fd 186argument -1 is interpreted as a reference to the main 187executable of the process, similar to 188.Va NULL 189value for the 190.Fa name 191argument to 192.Fn dlopen . 193The 194.Fn fdlopen 195function can be used by the code that needs to perform 196additional checks on the loaded objects, to prevent races with 197symlinking or renames. 198.Pp 199The |
|
167.Fn dlsym 168function 169returns the address binding of the symbol described in the null-terminated 170character string 171.Fa symbol , 172as it occurs in the shared object identified by 173.Fa handle . 174The symbols exported by objects added to the address space by --- 174 unchanged lines hidden (view full) --- 349compatibility with object code compiled from the C language. 350This is 351still the case when using the (obsolete) 352.Fl aout 353option to the C language compiler. 354.Sh ERRORS 355The 356.Fn dlopen , | 200.Fn dlsym 201function 202returns the address binding of the symbol described in the null-terminated 203character string 204.Fa symbol , 205as it occurs in the shared object identified by 206.Fa handle . 207The symbols exported by objects added to the address space by --- 174 unchanged lines hidden (view full) --- 382compatibility with object code compiled from the C language. 383This is 384still the case when using the (obsolete) 385.Fl aout 386option to the C language compiler. 387.Sh ERRORS 388The 389.Fn dlopen , |
390.Fn fdlopen , |
|
357.Fn dlsym , 358and 359.Fn dlfunc 360functions 361return a null pointer in the event of errors. 362The 363.Fn dlclose 364function 365returns 0 on success, or -1 if an error occurred. 366Whenever an error has been detected, a message detailing it can be 367retrieved via a call to 368.Fn dlerror . 369.Sh SEE ALSO 370.Xr ld 1 , 371.Xr rtld 1 , 372.Xr dladdr 3 , 373.Xr dlinfo 3 , 374.Xr link 5 | 391.Fn dlsym , 392and 393.Fn dlfunc 394functions 395return a null pointer in the event of errors. 396The 397.Fn dlclose 398function 399returns 0 on success, or -1 if an error occurred. 400Whenever an error has been detected, a message detailing it can be 401retrieved via a call to 402.Fn dlerror . 403.Sh SEE ALSO 404.Xr ld 1 , 405.Xr rtld 1 , 406.Xr dladdr 3 , 407.Xr dlinfo 3 , 408.Xr link 5 |