annotate doc/manual/manual_dyncall_api.tex @ 533:71c884e610f0

- integration of patches from Raphael Luba, Thekla, Inc.: * integration of aggregate-by-value (struct, union) support patch for x64 (win and sysv) * windows/x64 asm additions to specify how stack unwinds (help for debuggers, exception handling, etc.) * see Changelog for details - new calling convention modes for thiscalls (platform agnostic, was specific before) * new signature character for platform agnostic thiscalls ('*' / DC_SIGCHAR_CC_THISCALL) - dcCallF(), dcVCallF(), dcArgF() and dcVArgF(): * added support for aggregates-by-value (wasn't part of patch) * change that those functions don't implicitly call dcReset() anymore, which was unflexible (breaking change) - added macros to feature test implementation for aggregate-by-value and syscall support - changed libdyncall_s.lib and libdyncallback_s.lib order in callback test makefiles, as some toolchains are picky about order - doc: * man page updates to describe aggregate interface * manual overview changes to highlight platforms with aggregate-by-value support - test/plain: replaced tests w/ old/stale sctruct interface with new aggregate one
author Tassilo Philipp
date Thu, 21 Apr 2022 13:35:47 +0200
parents 17287342e273
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 %//////////////////////////////////////////////////////////////////////////////
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 %
533
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 490
diff changeset
3 % Copyright (c) 2007,2010-2022 Daniel Adler <dadler@uni-goettingen.de>,
71c884e610f0 - integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents: 490
diff changeset
4 % Tassilo Philipp <tphilipp@potion-studios.com>
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 %
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 % Permission to use, copy, modify, and distribute this software for any
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 % purpose with or without fee is hereby granted, provided that the above
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 % copyright notice and this permission notice appear in all copies.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 %
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 % THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 % WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 % MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 % ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 % WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 % ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 % OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 %
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 %//////////////////////////////////////////////////////////////////////////////
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19
467
b47168dacba6 manual:
Tassilo Philipp
parents: 365
diff changeset
20 \clearpage
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 \section{\emph{Dyncall} C library API}
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22
490
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
23 See the dyncall(3) manpage for more information.
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24
490
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
25 %@@@ removed, as manpages are more precise and up to date ------------------->
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26
490
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
27 %The library provides low-level functionality to make foreign function calls
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
28 %from different run-time environments. The flexibility is constrained by the
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
29 %set of supported types.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
30 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
31 %\paragraph{C interface style conventions}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
32 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
33 %This manual and the \product{dyncall} library's C interface {\tt "dyncall.h"}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
34 %use the following C source code style.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
35 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
36 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
37 %\begin{table}[h]
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
38 %\begin{center}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
39 %\begin{tabular*}{0.8\textwidth}{llll}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
40 %Subject & C symbol & Details & Example \\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
41 %\hline
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
42 %Types & {\tt DC\group{type name}} & lower-case & \capi{DCint}, \capi{DCfloat}, \capi{DClong}, \ldots\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
43 %Structures & {\tt DC\group{structure name}} & camel-case & \capi{DCCallVM}\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
44 %Functions & {\tt dc\group{function name}} & camel-case & \capi{dcNewCallVM}, \capi{dcArgInt}, \ldots\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
45 % & {\tt dcb\group{function name}} & & \capi{dcbNewCallback}, \ldots\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
46 % & {\tt dl\group{function name}} & & \capi{dlLoadLibrary}, \ldots\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
47 %\end{tabular*}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
48 %\caption{C interface conventions}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
49 %\label{sourcecode}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
50 %\end{center}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
51 %\end{table}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
52 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
53 %\subsection{Supported C/C++ argument and return types}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
54 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
55 %\begin{table}[h]
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
56 %\begin{center}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
57 %\begin{tabular*}{0.75\textwidth}{ll}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
58 %Type alias & C/C++ data type\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
59 %\hline
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
60 %DCbool & \_Bool, bool\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
61 %DCchar & char, unsigned char\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
62 %DCshort & short, unsigned short\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
63 %DCint & int, unsigned char\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
64 %DClong & long, unsigned char\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
65 %DClonglong & long long, unsigned char\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
66 %DCfloat & float\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
67 %DCdouble & double\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
68 %DCpointer & void*\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
69 %DCvoid & void\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
70 %\em{...} & \em{aggregates (struct, union)}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
71 %\end{tabular*}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
72 %\caption{Supported C/C++ argument and return types}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
73 %\label{types}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
74 %\end{center}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
75 %\end{table}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
76 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
77 %\pagebreak
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
78 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
79 %\subsection{Call Virtual Machine - CallVM}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
80 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
81 %This \emph{CallVM} is the main entry to the functionality of the library.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
82 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
83 %\paragraph{Types}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
84 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
85 %\begin{lstlisting}[language=c]
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
86 %typedef void DCCallVM; /* abstract handle */
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
87 %\end{lstlisting}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
88 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
89 %\paragraph{Details}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
90 %The \emph{CallVM} is a state machine that manages all aspects of a function
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
91 %call from configuration, argument passing up the actual function call on
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
92 %the processor.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
93 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
94 %\subsection{Allocation}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
95 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
96 %\paragraph{Functions}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
97 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
98 %\begin{lstlisting}[language=c]
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
99 %DCCallVM* dcNewCallVM (DCsize size);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
100 %void dcFree(DCCallVM* vm);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
101 %\end{lstlisting}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
102 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
103 %\lstinline{dcNewCallVM} creates a new \emph{CallVM} object, where
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
104 %\lstinline{size} specifies the max size of the internal stack that will be
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
105 %allocated and used to bind arguments to. Use \lstinline{dcFree} to
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
106 %destroy the \emph{CallVM} object.\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
107 %\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
108 %This will allocate memory using the system allocators or custom ones provided
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
109 %custom \capi{dcAllocMem} and \capi{dcFreeMem} macros are defined to override the
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
110 %default behaviour. See \capi{dyncall\_alloc.h} for defails.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
111 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
112 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
113 %\subsection{Error Reporting}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
114 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
115 %\paragraph{Function}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
116 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
117 %\begin{lstlisting}[language=c]
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
118 %DCint dcGetError(DCCallVM* vm);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
119 %\end{lstlisting}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
120 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
121 %Returns the most recent error state code out of the following:
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
122 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
123 %\paragraph{Errors}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
124 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
125 %\begin{table}[h]
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
126 %\begin{center}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
127 %\begin{tabular*}{0.95\textwidth}{ll}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
128 %Constant & Description\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
129 %\hline
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
130 %\lstinline@DC_ERROR_NONE@ & No error occured. \\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
131 %\lstinline@DC_ERROR_UNSUPPORTED_MODE@ & Unsupported mode, caused by \lstinline@dcMode()@ \\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
132 %\end{tabular*}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
133 %\caption{CallVM calling convention modes}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
134 %\label{errorcodes}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
135 %\end{center}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
136 %\end{table}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
137 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
138 %\pagebreak
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
139 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
140 %\subsection{Configuration}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
141 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
142 %\paragraph{Function}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
143 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
144 %\begin{lstlisting}[language=c]
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
145 %void dcMode (DCCallVM* vm, DCint mode);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
146 %\end{lstlisting}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
147 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
148 %Sets the calling convention to use. See dyncall.h for a list of available
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
149 %modes. Note that some mode/platform combination don't make any sense (e.g.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
150 %using a PowerPC calling convention on a MIPS platform) and are silently
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
151 %ignored.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
152 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
153 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
154 %\subsection{Machine state reset}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
155 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
156 %\begin{lstlisting}[language=c]
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
157 %void dcReset(DCCallVM* vm);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
158 %\end{lstlisting}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
159 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
160 %Resets the internal stack of arguments and prepares it for a new call. This
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
161 %function should be called after setting the initial/main call mode (using
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
162 %dcMode()), but prior to binding arguments to the CallVM (sometimes dcMode()
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
163 %calls are needed after pushing some args, e.g. DC\_SIGCHAR\_CC\_ELLIPSIS\_VARARGS,
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
164 %which is used prior to binding varargs of variadic functions). Use it also when
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
165 %reusing a CallVM, as arguments don't get flushed automatically after a function
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
166 %call invocation.\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
167 %Note: you should also call this function after initial creation of the a CallVM
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
168 %object, as dcNewCallVM doesn't do this, implicitly.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
169 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
170 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
171 %\subsection{Argument binding}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
172 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
173 %\paragraph{Functions}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
174 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
175 %\begin{lstlisting}[language=c]
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
176 %void dcArgBool (DCCallVM*, DCbool);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
177 %void dcArgChar (DCCallVM*, DCchar);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
178 %void dcArgShort (DCCallVM*, DCshort);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
179 %void dcArgInt (DCCallVM*, DCint);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
180 %void dcArgLong (DCCallVM*, DClong);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
181 %void dcArgLongLong(DCCallVM*, DClonglong);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
182 %void dcArgFloat (DCCallVM*, DCfloat);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
183 %void dcArgDouble (DCCallVM*, DCdouble);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
184 %void dcArgPointer (DCCallVM*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
185 %void dcArgAggr (DCCallVM*, const DCaggr*, const void*);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
186 %\end{lstlisting}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
187 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
188 %\paragraph{Details}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
189 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
190 %Used to bind arguments of the named types to the CallVM object.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
191 %Arguments should be bound in \emph{left-to-right} order regarding the C
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
192 %function prototype.\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
193 %\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
194 %See the dyncall(3) manpage for more information.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
195 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
196 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
197 %\subsection{Call invocation}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
198 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
199 %\paragraph{Functions}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
200 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
201 %\begin{lstlisting}[language=c]
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
202 %DCvoid dcCallVoid (DCCallVM*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
203 %DCbool dcCallBool (DCCallVM*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
204 %DCchar dcCallChar (DCCallVM*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
205 %DCshort dcCallShort (DCCallVM*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
206 %DCint dcCallInt (DCCallVM*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
207 %DClong dcCallLong (DCCallVM*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
208 %DClonglong dcCallLongLong(DCCallVM*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
209 %DCfloat dcCallFloat (DCCallVM*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
210 %DCdouble dcCallDouble (DCCallVM*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
211 %DCpointer dcCallPointer (DCCallVM*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
212 %DCpointer dcCallAggr(DCCallVM*, DCpointer, const DCaggr*, DCpointer);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
213 %void dcBeginCallAggr(DCCallVM*, const DCaggr*);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
214 %\end{lstlisting}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
215 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
216 %\paragraph{Details}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
217 %Calls the function specified by \emph{funcptr} with the arguments bound to
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
218 %the \emph{CallVM} and returns. Use the function that corresponds to the
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
219 %dynamically called function's return value.\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
220 %\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
221 %After the invocation of the foreign function call, the argument values are
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
222 %still bound and a second call using the same arguments can be issued. If you
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
223 %need to clear the argument bindings, you have to reset the \emph{CallVM}.\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
224 %\\
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
225 %See the dyncall(3) manpage for more information.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
226 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
227 %\subsection{Formatted argument binding and calls (ANSI C ellipsis interface)}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
228 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
229 %\paragraph{Functions}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
230 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
231 %\begin{lstlisting}[language=c]
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
232 %void dcArgF (DCCallVM*, const DCsigchar*, ...);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
233 %void dcVArgF (DCCallVM*, const DCsigchar*, va_list);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
234 %void dcCallF (DCCallVM*, DCValue*, DCpointer, const DCsigchar*, ...);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
235 %void dcVCallF(DCCallVM*, DCValue*, DCpointer, const DCsigchar*, va_list);
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
236 %\end{lstlisting}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
237 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
238 %\paragraph{Details}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
239 %
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
240 %These functions can be used to operate \product{dyncall} via a printf-style
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
241 %functional interface, using a signature string encoding the argument types and
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
242 %return type (and optionally also the calling convention used).
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
243 %\capi{dcArgF()} and \capi{dcVArgF()} just bind arguments to the \capi{DCCallVM}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
244 %object, so any return value specified in the signature is ignored. \capi{dcCallF()}
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
245 %and \capi{dcVCallF()} also take a function pointer to call after binding the arguments.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
246 %The return value will be stored in what \lstinline{result} points to.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
247 %For more information about the signature format, refer to \ref{sigchar}.
17287342e273 manual:
Tassilo Philipp
parents: 472
diff changeset
248 %