mirror of
https://github.com/partic2/libffi
synced 2026-11-10 18:17:19 +00:00
Fix cls_double_va.c and update docs
This commit is contained in:
+49
-25
@@ -1,10 +1,10 @@
|
|||||||
This is /home/green/libffi/doc/libffi.info, produced by makeinfo
|
This is ../libffi/doc/libffi.info, produced by makeinfo version 4.13
|
||||||
version 4.13 from /home/green/libffi/doc/libffi.texi.
|
from ../libffi/doc/libffi.texi.
|
||||||
|
|
||||||
This manual is for Libffi, a portable foreign-function interface
|
This manual is for Libffi, a portable foreign-function interface
|
||||||
library.
|
library.
|
||||||
|
|
||||||
Copyright (C) 2008, 2010 Red Hat, Inc.
|
Copyright (C) 2008, 2010, 2011 Red Hat, Inc.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this
|
Permission is granted to copy, distribute and/or modify this
|
||||||
document under the terms of the GNU General Public License as
|
document under the terms of the GNU General Public License as
|
||||||
@@ -27,7 +27,7 @@ libffi
|
|||||||
This manual is for Libffi, a portable foreign-function interface
|
This manual is for Libffi, a portable foreign-function interface
|
||||||
library.
|
library.
|
||||||
|
|
||||||
Copyright (C) 2008, 2010 Red Hat, Inc.
|
Copyright (C) 2008, 2010, 2011 Red Hat, Inc.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this
|
Permission is granted to copy, distribute and/or modify this
|
||||||
document under the terms of the GNU General Public License as
|
document under the terms of the GNU General Public License as
|
||||||
@@ -115,8 +115,6 @@ To prepare a call interface object, use the function `ffi_prep_cif'.
|
|||||||
want. *note Multiple ABIs:: for more information.
|
want. *note Multiple ABIs:: for more information.
|
||||||
|
|
||||||
NARGS is the number of arguments that this function accepts.
|
NARGS is the number of arguments that this function accepts.
|
||||||
`libffi' does not yet handle varargs functions; see *note Missing
|
|
||||||
Features:: for more information.
|
|
||||||
|
|
||||||
RTYPE is a pointer to an `ffi_type' structure that describes the
|
RTYPE is a pointer to an `ffi_type' structure that describes the
|
||||||
return type of the function. *Note Types::.
|
return type of the function. *Note Types::.
|
||||||
@@ -129,6 +127,30 @@ To prepare a call interface object, use the function `ffi_prep_cif'.
|
|||||||
properly; `FFI_BAD_TYPEDEF' if one of the `ffi_type' objects is
|
properly; `FFI_BAD_TYPEDEF' if one of the `ffi_type' objects is
|
||||||
incorrect; or `FFI_BAD_ABI' if the ABI parameter is invalid.
|
incorrect; or `FFI_BAD_ABI' if the ABI parameter is invalid.
|
||||||
|
|
||||||
|
If the function being called is variadic (varargs) then
|
||||||
|
`ffi_prep_cif_var' must be used instead of `ffi_prep_cif'.
|
||||||
|
|
||||||
|
-- Function: ffi_status ffi_prep_cif_var (ffi_cif *CIF, ffi_abi
|
||||||
|
varabi, unsigned int NFIXEDARGS, unsigned int varntotalargs,
|
||||||
|
ffi_type *RTYPE, ffi_type **ARGTYPES)
|
||||||
|
This initializes CIF according to the given parameters for a call
|
||||||
|
to a variadic function. In general it's operation is the same as
|
||||||
|
for `ffi_prep_cif' except that:
|
||||||
|
|
||||||
|
NFIXEDARGS is the number of fixed arguments, prior to any variadic
|
||||||
|
arguments. It must be greater than zero.
|
||||||
|
|
||||||
|
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 `ffi_prep_cif_var' with
|
||||||
|
NFIXEDARGS=NOTOTALARGS is NOT equivalent to a call to
|
||||||
|
`ffi_prep_cif'.
|
||||||
|
|
||||||
|
|
||||||
To call a function using an initialized `ffi_cif', use the
|
To call a function using an initialized `ffi_cif', use the
|
||||||
`ffi_call' function:
|
`ffi_call' function:
|
||||||
|
|
||||||
@@ -511,9 +533,7 @@ File: libffi.info, Node: Missing Features, Next: Index, Prev: Using libffi,
|
|||||||
`libffi' is missing a few features. We welcome patches to add support
|
`libffi' is missing a few features. We welcome patches to add support
|
||||||
for these.
|
for these.
|
||||||
|
|
||||||
* There is no support for calling varargs functions. This may work
|
* Variadic closures.
|
||||||
on some platforms, depending on how the ABI is defined, but it is
|
|
||||||
not reliable.
|
|
||||||
|
|
||||||
* There is no support for bit fields in structures.
|
* There is no support for bit fields in structures.
|
||||||
|
|
||||||
@@ -521,6 +541,9 @@ for these.
|
|||||||
|
|
||||||
* The "raw" API is undocumented.
|
* The "raw" API is undocumented.
|
||||||
|
|
||||||
|
Note that variadic support is very new and tested on a relatively
|
||||||
|
small number of platforms.
|
||||||
|
|
||||||
|
|
||||||
File: libffi.info, Node: Index, Prev: Missing Features, Up: Top
|
File: libffi.info, Node: Index, Prev: Missing Features, Up: Top
|
||||||
|
|
||||||
@@ -538,11 +561,12 @@ Index
|
|||||||
* closure API: The Closure API. (line 13)
|
* closure API: The Closure API. (line 13)
|
||||||
* closures: The Closure API. (line 13)
|
* closures: The Closure API. (line 13)
|
||||||
* FFI: Introduction. (line 31)
|
* FFI: Introduction. (line 31)
|
||||||
* ffi_call: The Basics. (line 41)
|
* ffi_call: The Basics. (line 63)
|
||||||
* ffi_closure_alloc: The Closure API. (line 19)
|
* ffi_closure_alloc: The Closure API. (line 19)
|
||||||
* ffi_closure_free: The Closure API. (line 26)
|
* ffi_closure_free: The Closure API. (line 26)
|
||||||
* FFI_CLOSURES: The Closure API. (line 13)
|
* FFI_CLOSURES: The Closure API. (line 13)
|
||||||
* ffi_prep_cif: The Basics. (line 16)
|
* ffi_prep_cif: The Basics. (line 16)
|
||||||
|
* ffi_prep_cif_var: The Basics. (line 39)
|
||||||
* ffi_prep_closure_loc: The Closure API. (line 34)
|
* ffi_prep_closure_loc: The Closure API. (line 34)
|
||||||
* ffi_status <1>: The Closure API. (line 37)
|
* ffi_status <1>: The Closure API. (line 37)
|
||||||
* ffi_status: The Basics. (line 18)
|
* ffi_status: The Basics. (line 18)
|
||||||
@@ -570,24 +594,24 @@ Index
|
|||||||
* ffi_type_void: Primitive Types. (line 10)
|
* ffi_type_void: Primitive Types. (line 10)
|
||||||
* Foreign Function Interface: Introduction. (line 31)
|
* Foreign Function Interface: Introduction. (line 31)
|
||||||
* void <1>: The Closure API. (line 20)
|
* void <1>: The Closure API. (line 20)
|
||||||
* void: The Basics. (line 43)
|
* void: The Basics. (line 65)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Tag Table:
|
Tag Table:
|
||||||
Node: Top724
|
Node: Top712
|
||||||
Node: Introduction1466
|
Node: Introduction1460
|
||||||
Node: Using libffi3102
|
Node: Using libffi3096
|
||||||
Node: The Basics3588
|
Node: The Basics3582
|
||||||
Node: Simple Example6374
|
Node: Simple Example7224
|
||||||
Node: Types7401
|
Node: Types8251
|
||||||
Node: Primitive Types7684
|
Node: Primitive Types8534
|
||||||
Node: Structures9504
|
Node: Structures10354
|
||||||
Node: Type Example10364
|
Node: Type Example11214
|
||||||
Node: Multiple ABIs11587
|
Node: Multiple ABIs12437
|
||||||
Node: The Closure API11958
|
Node: The Closure API12808
|
||||||
Node: Closure Example14902
|
Node: Closure Example15752
|
||||||
Node: Missing Features16461
|
Node: Missing Features17311
|
||||||
Node: Index16954
|
Node: Index17764
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
@set UPDATED 12 November 2011
|
@set UPDATED 12 November 2011
|
||||||
@set UPDATED-MONTH November 2011
|
@set UPDATED-MONTH November 2011
|
||||||
@set EDITION 3.0.11-rc1
|
@set EDITION 3.0.11-rc2
|
||||||
@set VERSION 3.0.11-rc1
|
@set VERSION 3.0.11-rc2
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
@set UPDATED 12 November 2011
|
@set UPDATED 12 November 2011
|
||||||
@set UPDATED-MONTH November 2011
|
@set UPDATED-MONTH November 2011
|
||||||
@set EDITION 3.0.11-rc1
|
@set EDITION 3.0.11-rc2
|
||||||
@set VERSION 3.0.11-rc1
|
@set VERSION 3.0.11-rc2
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ int main (void)
|
|||||||
printf("res: %d\n", (int) res);
|
printf("res: %d\n", (int) res);
|
||||||
// { dg-output "\nres: 4" }
|
// { dg-output "\nres: 4" }
|
||||||
|
|
||||||
|
/* The call to cls_double_va_fn is static, so have to use a normal prep_cif */
|
||||||
|
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK);
|
||||||
|
|
||||||
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK);
|
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK);
|
||||||
|
|
||||||
res = ((int(*)(char*, double))(code))(format, doubleArg);
|
res = ((int(*)(char*, double))(code))(format, doubleArg);
|
||||||
|
|||||||
Reference in New Issue
Block a user