| Index: include/static_ffi.h
|
| diff --git a/include/static_ffi.h b/include/static_ffi.h
|
| index d5488cdf147fac14c71eee62182f8841143bac2b..5762769470ae7ea250bc49eaeee76b3a2d54ee20 100644
|
| --- a/include/static_ffi.h
|
| +++ b/include/static_ffi.h
|
| @@ -5,18 +5,18 @@
|
| #ifndef INCLUDE_STATIC_FFI_H_
|
| #define INCLUDE_STATIC_FFI_H_
|
|
|
| -#include "include/fletch_api.h"
|
| +#include "include/dartino_api.h"
|
|
|
| /**
|
| - * The static FFI interface of fletch can be used in two ways. The easiest way
|
| + * The static FFI interface of dartino can be used in two ways. The easiest way
|
| * is to define an export table that covers all functions that should be
|
| - * available via FFI. This is done using the FLETCH_EXPORT_TABLE macros
|
| + * available via FFI. This is done using the DARTINO_EXPORT_TABLE macros
|
| * defined below.
|
| *
|
| - * FLETCH_EXPORT_TABLE_BEGIN
|
| - * FLETCH_EXPORT_TABLE_ENTRY("magic_meat", FFITestMagicMeat)
|
| - * FLETCH_EXPORT_TABLE_ENTRY("magic_veg", FFITestMagicVeg)
|
| - * FLETCH_EXPORT_TABLE_END
|
| + * DARTINO_EXPORT_TABLE_BEGIN
|
| + * DARTINO_EXPORT_TABLE_ENTRY("magic_meat", FFITestMagicMeat)
|
| + * DARTINO_EXPORT_TABLE_ENTRY("magic_veg", FFITestMagicVeg)
|
| + * DARTINO_EXPORT_TABLE_END
|
| *
|
| * While easy to integrate into an existing build, this solution does not
|
| * compose well. All exported functions have to be declared in a single
|
| @@ -27,8 +27,8 @@
|
| * the output declaration of the rodata section in your linker script
|
| *
|
| * . = ALIGN(4);
|
| - * fletch_ffi_table = .;
|
| - * KEEP(*(.fletchffi))
|
| + * dartino_ffi_table = .;
|
| + * KEEP(*(.dartinoffi))
|
| * QUAD(0)
|
| * QUAD(0)
|
| * . = ALIGN(4);
|
| @@ -36,41 +36,42 @@
|
| * and export all external functions you want to call via FFI using the below
|
| * two macros:
|
| *
|
| - * FLETCH_EXPORT_STATIC(fun) exports the C function 'fun' as 'fun' in dart.
|
| + * DARTINO_EXPORT_STATIC(fun) exports the C function 'fun' as 'fun' in dart.
|
| *
|
| - * FLETCH_EXPORT_STATIC_RENAME(name, fun) exports the C function 'fun' as
|
| + * DARTINO_EXPORT_STATIC_RENAME(name, fun) exports the C function 'fun' as
|
| * 'name' in dart.
|
| */
|
|
|
| typedef struct {
|
| const char* const name;
|
| const void* const ptr;
|
| -} FletchStaticFFISymbol;
|
| +} DartinoStaticFFISymbol;
|
|
|
| #ifdef __cplusplus
|
| -#define FLETCH_EXPORT_TABLE_BEGIN \
|
| +#define DARTINO_EXPORT_TABLE_BEGIN \
|
| extern "C" { \
|
| - FLETCH_VISIBILITY_DEFAULT FletchStaticFFISymbol fletch_ffi_table[] = {
|
| -#define FLETCH_EXPORT_TABLE_ENTRY(name, fun) \
|
| + DARTINO_VISIBILITY_DEFAULT DartinoStaticFFISymbol dartino_ffi_table[] = {
|
| +#define DARTINO_EXPORT_TABLE_ENTRY(name, fun) \
|
| {name, reinterpret_cast<const void*>(&fun)},
|
| -#define FLETCH_EXPORT_TABLE_END {NULL, NULL}};}
|
| +#define DARTINO_EXPORT_TABLE_END {NULL, NULL}};}
|
| #else
|
| -#define FLETCH_EXPORT_TABLE_BEGIN \
|
| - FLETCH_VISIBILITY_DEFAULT FletchStaticFFISymbol fletch_ffi_table[] = {
|
| -#define FLETCH_EXPORT_TABLE_ENTRY(name, fun) {name, &fun},
|
| -#define FLETCH_EXPORT_TABLE_END {NULL, NULL}};
|
| +#define DARTINO_EXPORT_TABLE_BEGIN \
|
| + DARTINO_VISIBILITY_DEFAULT DartinoStaticFFISymbol dartino_ffi_table[] = {
|
| +#define DARTINO_EXPORT_TABLE_ENTRY(name, fun) {name, &fun},
|
| +#define DARTINO_EXPORT_TABLE_END {NULL, NULL}};
|
| #endif
|
|
|
| -#define FLETCH_FUNCTION_NAME(name) #name
|
| -#define FLETCH_EXPORT_FFI FLETCH_EXPORT __attribute__((section(".fletchffi")))
|
| +#define DARTINO_FUNCTION_NAME(name) #name
|
| +#define DARTINO_EXPORT_FFI \
|
| + DARTINO_EXPORT __attribute__((section(".dartinoffi")))
|
|
|
| -#define FLETCH_EXPORT_STATIC(fun) \
|
| - FLETCH_EXPORT_FFI FletchStaticFFISymbol fletch_ffi_entry_ ## fun = { \
|
| - FLETCH_FUNCTION_NAME(fun), \
|
| - &fun }; \
|
| +#define DARTINO_EXPORT_STATIC(fun) \
|
| + DARTINO_EXPORT_FFI DartinoStaticFFISymbol dartino_ffi_entry_ ## fun = { \
|
| + DARTINO_FUNCTION_NAME(fun), \
|
| + &fun }; \
|
|
|
| -#define FLETCH_EXPORT_STATIC_RENAME(name, fun) \
|
| - FLETCH_EXPORT_FFI FletchStaticFFISymbol fletch_ffi_entry_ ## name = { \
|
| - #name, &fun }; \
|
| +#define DARTINO_EXPORT_STATIC_RENAME(name, fun) \
|
| + DARTINO_EXPORT_FFI DartinoStaticFFISymbol dartino_ffi_entry_ ## name = { \
|
| + #name, &fun }; \
|
|
|
| #endif // INCLUDE_STATIC_FFI_H_
|
|
|