diff options
author | Anthony Green <green@moxielogic.com> | 2011-11-12 17:18:51 -0500 |
---|---|---|
committer | Anthony Green <green@moxielogic.com> | 2011-11-12 17:18:51 -0500 |
commit | ff9454da44859716a5bd4eaa344499288c79694f (patch) | |
tree | d5ad99ea8bc87ff986f91db1401383d89aa49cc8 /doc | |
parent | ea14ae85e8f54ff046b7fb8a9cfe349475272044 (diff) | |
download | libffi-ff9454da44859716a5bd4eaa344499288c79694f.tar.gz |
Add David Gilbert's variadic function call support
Diffstat (limited to 'doc')
-rw-r--r-- | doc/libffi.texi | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/doc/libffi.texi b/doc/libffi.texi index 5cdd667..8c4ce87 100644 --- a/doc/libffi.texi +++ b/doc/libffi.texi @@ -19,7 +19,7 @@ This manual is for Libffi, a portable foreign-function interface library. -Copyright @copyright{} 2008, 2010 Red Hat, Inc. +Copyright @copyright{} 2008, 2010, 2011 Red Hat, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -133,8 +133,6 @@ This initializes @var{cif} according to the given parameters. you want. @ref{Multiple ABIs} for more information. @var{nargs} is the number of arguments that this function accepts. -@samp{libffi} does not yet handle varargs functions; see @ref{Missing -Features} for more information. @var{rtype} is a pointer to an @code{ffi_type} structure that describes the return type of the function. @xref{Types}. @@ -150,6 +148,32 @@ objects is incorrect; or @code{FFI_BAD_ABI} if the @var{abi} parameter is invalid. @end defun +If the function being called is variadic (varargs) then +@code{ffi_prep_cif_var} must be used instead of @code{ffi_prep_cif}. + +@findex ffi_prep_cif_var +@defun ffi_status ffi_prep_cif_var (ffi_cif *@var{cif}, ffi_abi +var{abi}, unsigned int @var{nfixedargs}, unsigned int +var{ntotalargs}, ffi_type *@var{rtype}, ffi_type **@var{argtypes}) +This initializes @var{cif} according to the given parameters for +a call to a variadic function. In general it's operation is the +same as for @code{ffi_prep_cif} except that: + +@var{nfixedargs} is the number of fixed arguments, prior to any +variadic arguments. It must be greater than zero. + +@var{ntotalargs} the total number of arguments, including variadic +and fixed arguments. + +Note that, different cif's must be prepped for calls to the same +function when different numbers of arguments are passed. + +Also note that a call to @code{ffi_prep_cif_var} with +@var{nfixedargs}=@var{nototalargs} is NOT equivalent to a call to +@code{ffi_prep_cif}. + +@end defun + To call a function using an initialized @code{ffi_cif}, use the @code{ffi_call} function: @@ -572,9 +596,7 @@ support for these. @itemize @bullet @item -There is no support for calling varargs functions. This may work on -some platforms, depending on how the ABI is defined, but it is not -reliable. +Variadic closures. @item There is no support for bit fields in structures. @@ -591,6 +613,8 @@ The ``raw'' API is undocumented. @c anything else? @end itemize +Note that variadic support is very new and tested on a relatively +small number of platforms. @node Index @unnumbered Index |