annotate dynload/dynload.3 @ 228:f8a6e60598cc

- completed dynload API doc
author Tassilo Philipp
date Sun, 16 Apr 2017 13:34:39 +0200
parents 7076f551faf5
children 2a77747a5496
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
216
28bf0b231bce - dynload man page clarification about resolving own symbols
Tassilo Philipp
parents: 93
diff changeset
1 .\" Copyright (c) 2007-2017 Daniel Adler <dadler AT uni-goettingen DOT de>,
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 .\" Tassilo Philipp <tphilipp AT potion-studios DOT com>
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 .\"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 .\" Permission to use, copy, modify, and distribute this software for any
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 .\" purpose with or without fee is hereby granted, provided that the above
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 .\" copyright notice and this permission notice appear in all copies.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 .\"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 .\"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 .Dd $Mdocdate$
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 .Dt dynload 3
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 .Sh NAME
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 .Nm dynload
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 .Nd encapsulates dynamic loading mechanisms and
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 gives access to functions in foreign dynamic libraries and code modules.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 .Sh SYNOPSIS
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23 .In dynload.h
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 .Ft DLLib *
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 .Fn dlLoadLibrary "const char * libpath"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 .Ft void
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 .Fn dlFreeLibrary "DLLib * pLib"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 .Ft void *
216
28bf0b231bce - dynload man page clarification about resolving own symbols
Tassilo Philipp
parents: 93
diff changeset
29 .Fn dlFindSymbol "DLLib * pLib" "const char * pSymbolName"
228
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
30 .Ft DLSyms*
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
31 .Fn dlSymsInit "const char * libPath"
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
32 .Ft void
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
33 .Fn dlSymsCleanup "DLSyms * pSyms"
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
34 .Ft int
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
35 .Fn dlSymsCount "DLSyms * pSyms"
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
36 .Ft const char*
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
37 .Fn dlSymsName "DLSyms * pSyms" "int index"
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
38 .Ft const char*
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
39 .Fn dlSymsNameFromValue "DLSyms * pSyms" "void * value"
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 .Sh DESCRIPTION
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 The
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 .Nm
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43 library provides an interface to load foreign dynamic libraries and access
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 to their symbols.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 .Pp
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 .Fn dlLoadLibrary
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 loads a dynamic library at
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 .Ar libpath
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 and returns a handle to it for use in
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 .Fn dlFreeLibrary
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 and
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 .Fn dlFindSymbol
216
28bf0b231bce - dynload man page clarification about resolving own symbols
Tassilo Philipp
parents: 93
diff changeset
53 calls. Passing a null pointer for the
28bf0b231bce - dynload man page clarification about resolving own symbols
Tassilo Philipp
parents: 93
diff changeset
54 .Ar libpath
28bf0b231bce - dynload man page clarification about resolving own symbols
Tassilo Philipp
parents: 93
diff changeset
55 argument is valid, and returns a handle to the main executable of the calling code. Returns a null pointer on error.
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 .Pp
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 .Fn dlFreeLibrary
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 frees the loaded library with handle
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 .Ar pLib .
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 .Pp
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61 .Fn dlFindSymbol
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 returns a pointer to a symbol with name
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63 .Ar pSymbolName
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 in the library with handle
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
65 .Ar pLib ,
223
7076f551faf5 - dynload mach-o handling fixes for 64bit platforms
Tassilo Philipp
parents: 216
diff changeset
66 or returns a null pointer if the symbol cannot be found. The name is specified as it would appear in C source code (mangled if C++, etc.).
228
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
67 .Pp
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
68 The dlSyms* functions can be used to iterate over symbols. Note that they are made
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
69 for symbol name lookups, not to get a symbol's address. For that refer to
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
70 .Fn dlFindSymbol .
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
71 .Fn dlSymsInit
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
72 will return a handle (or null pointer on error) to the shared object specified by
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
73 .Ar libPath .
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
74 The returned handle is to be used with the other dlSyms* functions. The handle must be freed with
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
75 .Fn dlSymsCleanup .
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
76 .Fn dlSymsCount
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
77 returns the number of symbols in the shared object,
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
78 .Fn dlSymsName
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
79 and
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
80 .Fn dlSymsNameFromValue
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
81 are used to lookup symbol names using an index or symbol's address, respectively, returning a null pointer on error. The names are returned as they would appear in C source code (mangled if C++, etc.). The address passed to
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
82 .Fn dlSymsNameFromValue
f8a6e60598cc - completed dynload API doc
Tassilo Philipp
parents: 223
diff changeset
83 must point to a loaded symbol.
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84 .Sh SEE ALSO
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 .Xr dyncall 3 ,
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86 .Xr dyncallback 3
93
dfde5035d410 - better, more neutral .3 SEE ALSO
cslag
parents: 81
diff changeset
87 and the dyncall manual (available in HTML and PDF format) for more information.
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88 .Sh AUTHORS
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89 .An "Daniel Adler" Aq dadler@uni-goettingen.de
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90 .An "Tassilo Philipp" Aq tphilipp@potion-studios.com