ffi_prep_cif.3 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. .Dd February 15, 2008
  2. .Dt ffi_prep_cif 3
  3. .Sh NAME
  4. .Nm ffi_prep_cif
  5. .Nd Prepare a
  6. .Nm ffi_cif
  7. structure for use with
  8. .Nm ffi_call
  9. .
  10. .Sh SYNOPSIS
  11. .In ffi.h
  12. .Ft ffi_status
  13. .Fo ffi_prep_cif
  14. .Fa "ffi_cif *cif"
  15. .Fa "ffi_abi abi"
  16. .Fa "unsigned int nargs"
  17. .Fa "ffi_type *rtype"
  18. .Fa "ffi_type **atypes"
  19. .Fc
  20. .Sh DESCRIPTION
  21. The
  22. .Nm ffi_prep_cif
  23. function prepares a
  24. .Nm ffi_cif
  25. structure for use with
  26. .Nm ffi_call
  27. .
  28. .Fa abi
  29. specifies a set of calling conventions to use.
  30. .Fa atypes
  31. is an array of
  32. .Fa nargs
  33. pointers to
  34. .Nm ffi_type
  35. structs that describe the data type, size and alignment of each argument.
  36. .Fa rtype
  37. points to an
  38. .Nm ffi_type
  39. that describes the data type, size and alignment of the
  40. return value. Note that to call a variadic function
  41. .Nm ffi_prep_cif_var
  42. must be used instead.
  43. .Sh RETURN VALUES
  44. Upon successful completion,
  45. .Nm ffi_prep_cif
  46. returns
  47. .Nm FFI_OK .
  48. It will return
  49. .Nm FFI_BAD_TYPEDEF
  50. if
  51. .Fa cif
  52. is
  53. .Nm NULL
  54. or
  55. .Fa atypes
  56. or
  57. .Fa rtype
  58. is malformed. If
  59. .Fa abi
  60. does not refer to a valid ABI,
  61. .Nm FFI_BAD_ABI
  62. will be returned. Available ABIs are
  63. defined in
  64. .Nm <ffitarget.h> .
  65. .Sh SEE ALSO
  66. .Xr ffi 3 ,
  67. .Xr ffi_call 3 ,
  68. .Xr ffi_prep_cif_var 3