+2013-11-15 Andrew Haley <aph@redhat.com>
+
+ * doc/libffi.texi (Closure Example): Fix the sample code.
+ * doc/libffi.info, doc/stamp-vti, doc/version.texi: Rebuilt.
+
2013-11-15 Andrew Haley <aph@redhat.com>
* testsuite/libffi.call/va_struct1.c (main): Fix broken test.
#include <ffi.h>
/* Acts like puts with the file given at time of enclosure. */
- void puts_binding(ffi_cif *cif, ffi_arg *ret, void* args[],
- FILE *stream)
+ void puts_binding(ffi_cif *cif, void *ret, void* args[],
+ void *stream)
{
- *ret = fputs(*(char **)args[0], stream);
+ *(ffi_arg *)ret = fputs(*(char **)args[0], (FILE *)stream);
}
+ typedef int (*puts_t)(char *);
+
int main()
{
ffi_cif cif;
ffi_type *args[1];
ffi_closure *closure;
- int (*bound_puts)(char *);
+ void *bound_puts;
int rc;
/* Allocate closure and bound_puts */
if (ffi_prep_closure_loc(closure, &cif, puts_binding,
stdout, bound_puts) == FFI_OK)
{
- rc = bound_puts("Hello World!");
+ rc = ((puts_t)bound_puts)("Hello World!");
/* rc now holds the result of the call to fputs */
}
}
Node: Multiple ABIs\7f12473
Node: The Closure API\7f12844
Node: Closure Example\7f15788
-Node: Missing Features\7f17342
-Node: Index\7f17795
+Node: Missing Features\7f17396
+Node: Index\7f17849
\1f
End Tag Table
#include <ffi.h>
/* Acts like puts with the file given at time of enclosure. */
-void puts_binding(ffi_cif *cif, ffi_arg *ret, void* args[],
- FILE *stream)
+void puts_binding(ffi_cif *cif, void *ret, void* args[],
+ void *stream)
@{
- *ret = fputs(*(char **)args[0], stream);
+ *(ffi_arg *)ret = fputs(*(char **)args[0], (FILE *)stream);
@}
+typedef int (*puts_t)(char *);
+
int main()
@{
ffi_cif cif;
ffi_type *args[1];
ffi_closure *closure;
- int (*bound_puts)(char *);
+ void *bound_puts;
int rc;
-
+
/* Allocate closure and bound_puts */
closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts);
&ffi_type_sint, args) == FFI_OK)
@{
/* Initialize the closure, setting stream to stdout */
- if (ffi_prep_closure_loc(closure, &cif, puts_binding,
+ if (ffi_prep_closure_loc(closure, &cif, puts_binding,
stdout, bound_puts) == FFI_OK)
@{
- rc = bound_puts("Hello World!");
+ rc = ((puts_t)bound_puts)("Hello World!");
/* rc now holds the result of the call to fputs */
@}
@}
-@set UPDATED 13 November 2013
+@set UPDATED 16 November 2013
@set UPDATED-MONTH November 2013
@set EDITION 3.0.14-rc0
@set VERSION 3.0.14-rc0
-@set UPDATED 13 November 2013
+@set UPDATED 16 November 2013
@set UPDATED-MONTH November 2013
@set EDITION 3.0.14-rc0
@set VERSION 3.0.14-rc0