| Initial commit: V -> Flutter FFI plugin ad0ccda nandi 6h ago | 1 | // C-ABI surface of the V library. Hand-maintained; ffigen parses this. |
| 2 | #ifndef VFLUTTER_H |
| 3 | #define VFLUTTER_H |
| 4 | |
| 5 | #ifdef __cplusplus |
| 6 | extern "C" { |
| 7 | #endif |
| 8 | |
| 9 | #if defined(_WIN32) |
| 10 | #define VF_API __declspec(dllexport) |
| 11 | #else |
| 12 | #define VF_API __attribute__((visibility("default"))) |
| 13 | #endif |
| 14 | |
| 15 | // Idempotent. Safe to call from any isolate; required only on platforms |
| 16 | // where the ELF/Mach-O constructor may not have run (iOS static archives). |
| 17 | VF_API void vf_init(void); |
| 18 | |
| 19 | VF_API int vf_add(int a, int b); |
| 20 | |
| 21 | // Returns a NUL-terminated string allocated by V. Caller MUST release it |
| 22 | // with vf_free. Never free it with Dart's calloc/malloc. |
| 23 | VF_API char *vf_greet(const char *name); |
| 24 | |
| 25 | VF_API void vf_free(void *p); |
| 26 | |
| 27 | #ifdef __cplusplus |
| 28 | } |
| 29 | #endif |
| 30 | #endif // VFLUTTER_H |