comparison dynload/dynload.3 @ 315:3840e0188520

- allowing lookup of running executable's path by passing NULL to dynload's dlGetLibraryPath()
author Tassilo Philipp
date Wed, 06 Nov 2019 14:13:49 +0100
parents 7c6f19d42b31
children 3df50603afa9
comparison
equal deleted inserted replaced
314:b2e4e23d9953 315:3840e0188520
78 .Ar bufSize 78 .Ar bufSize
79 (in bytes), to hold the output string (UTF-8 encoded). The return value is the size of the buffer (in bytes) needed to hold the null-terminated string, or 0 if it can't be looked up. If 79 (in bytes), to hold the output string (UTF-8 encoded). The return value is the size of the buffer (in bytes) needed to hold the null-terminated string, or 0 if it can't be looked up. If
80 .Ar bufSize 80 .Ar bufSize
81 >= return value >= 1, a null-terminted string with the path to the library should be in 81 >= return value >= 1, a null-terminted string with the path to the library should be in
82 .Ar sOut . 82 .Ar sOut .
83 If it returns 0, the library name wasn't able to be found. Please note that this might happen in some rare cases, so make sure to always check. 83 If it returns 0, the library name wasn't able to be found. Please note that this might happen in some rare cases, so make sure to always check. Passing a null pointer as
84 .Ar pLib
85 returns the path to the executable (not guaranteed to be absolute).
84 .Pp 86 .Pp
85 The dlSyms* functions can be used to iterate over symbols. Since they can be used on libraries that are not linked, they are made 87 The dlSyms* functions can be used to iterate over symbols. Since they can be used on libraries that are not linked, they are made
86 for symbol name lookups, not to get symbols' addresses. For that refer to 88 for symbol name lookups, not to get symbols' addresses. For that refer to
87 .Fn dlFindSymbol . 89 .Fn dlFindSymbol .
88 .Fn dlSymsInit 90 .Fn dlSymsInit
99 .Fn dlSymsNameFromValue 101 .Fn dlSymsNameFromValue
100 must point to a loaded symbol. 102 must point to a loaded symbol.
101 .Sh BUGS 103 .Sh BUGS
102 .Fn dlGetLibraryPath 104 .Fn dlGetLibraryPath
103 is not thread-safe on Darwin (macOS, iOS, ...) and OpenBSD. 105 is not thread-safe on Darwin (macOS, iOS, ...) and OpenBSD.
106 .Pp
104 .Fn dlSymsInit 107 .Fn dlSymsInit
105 is not thread-safe on Darwin. 108 is not thread-safe on Darwin.
109 .Pp
106 .Fn dlGetLibraryPath 110 .Fn dlGetLibraryPath
107 will not work on the following platforms when the library in question doesn't have the (default) 111 will not work on the following platforms when the library in question doesn't have the (default)
108 .Fn _init 112 .Fn _init
109 and 113 and
110 .Fn _fini 114 .Fn _fini
111 symbols exported (rare, but possible): Haiku (all versions), OpenBSD < 3.7, NetBSD < 5.1, FreeBSD < 4.8 115 symbols exported (rare, but possible): Haiku (all versions), OpenBSD < 3.7, NetBSD < 5.1, FreeBSD < 4.8
116 .Pp
117 Getting the executable's path by passing NULL in
118 .Ar pLib
119 to
120 .Fn dlGetLibraryPath
121 fails on the following platforms: Haiku (all versions), OpenBSD < 3.7, NetBSD < 5.1, FreeBSD < 4.8
112 .Sh CONFORMING TO 122 .Sh CONFORMING TO
113 The dynload library conforms to c99. 123 The dynload library conforms to c99.
114 .Ed 124 .Ed
115 .Sh SEE ALSO 125 .Sh SEE ALSO
116 .Xr dyncall 3 , 126 .Xr dyncall 3 ,