feat: Add ffi_get_default_abi and ffi_get_closure_size functions

This commit is contained in:
Anthony Green 2025-06-08 07:30:54 -04:00
parent b14d43793a
commit 074c423f86
5 changed files with 30 additions and 1 deletions

View File

@ -206,6 +206,7 @@ See the git log for details at http://github.com/libffi/libffi.
3.5.0 Jun-8-2025
Add FFI_VERSION_STRING and FFI_VERSION_NUMBER macros, as well
as ffi_get_version() and ffi_get_version_number() functions.
Add ffi_get_default_abi() and ffi_get_closure_size() functions.
Fix closures on powerpc64-linux when statically linking.
Mark the PA stack as non-executable.

View File

@ -250,6 +250,16 @@ This number is also available at build time as the macro
@code{FFI_VERSION_NUMBER}.
@end defun
@findex ffi_get_default_abi
@defun {unsigned int} ffi_get_default_abi (void)
Return the value of @code{FFI_DEFAULT_ABI}.
@end defun
@findex ffi_get_closure_size
@defun {size_t} ffi_get_closure_size (void)
Return @code{sizeof(ffi_closure)}.
@end defun
@node Simple Example
@section Simple Example

View File

@ -327,6 +327,11 @@ FFI_API const char *ffi_get_version (void);
FFI_API unsigned long ffi_get_version_number (void);
#endif
/* ---- Internals API ---------------------------------------------------- */
FFI_API unsigned int ffi_get_default_abi (void);
FFI_API size_t ffi_get_closure_size (void);
/* ---- Definitions for closures ----------------------------------------- */
#if FFI_CLOSURES

View File

@ -27,6 +27,9 @@ LIBFFI_BASE_8.0 {
ffi_get_version;
ffi_get_version_number;
ffi_get_default_abi;
ffi_get_closure_size;
ffi_call;
ffi_prep_cif;
ffi_prep_cif_var;

View File

@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------
types.c - Copyright (c) 1996, 1998, 2024 Red Hat, Inc.
types.c - Copyright (c) 1996, 1998, 2024, 2025 Red Hat, Inc.
Predefined ffi_types needed by libffi.
@ -43,6 +43,16 @@ unsigned long ffi_get_version_number (void)
return FFI_VERSION_NUMBER;
}
unsigned int ffi_get_default_abi (void)
{
return FFI_DEFAULT_ABI;
}
size_t ffi_get_closure_size (void)
{
return sizeof(ffi_closure);
}
/* Type definitions */
#define FFI_TYPEDEF(name, type, id, maybe_const)\