nandi/vflutter_ffipublic Fork 0
81540bbed5044d569fccbcb6c081878d54bbbd5b
Commits
Clone
git clone https://git.rickub.com/nandi/vflutter_ffi.git
git clone ssh://git@rickub.com/nandi/vflutter_ffi.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

vflutter.h · 40 lines · 1.2 KBC Blame HistoryRaw
Initial commit: V -> Flutter FFI plugin ad0ccda nandi 11h ago1// C-ABI surface of the V library. Hand-maintained; ffigen parses this.
2#ifndef VFLUTTER_H
3#define VFLUTTER_H
4
5#ifdef __cplusplus
6extern "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).
17VF_API void vf_init(void);
18
19VF_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.
23VF_API char *vf_greet(const char *name);
24
25VF_API void vf_free(void *p);
26
Add a Mandelbrot example app, and a V kernel worth demonstrating 81540bb nandithebull 7h ago27// Fills rows [y0, y1) of a w x h Mandelbrot image as RGBA8888, packed from
28// the start of `buf`. The buffer is owned by the CALLER: V allocates nothing
29// here and there is nothing to vf_free. Bands are independent, so separate
30// calls may run concurrently on different threads/isolates.
31//
32// `buf` must hold at least (y1 - y0) * w * 4 bytes.
33VF_API void vf_mandelbrot(unsigned char *buf, int w, int h, double cx,
34 double cy, double scale, int max_iter, int y0,
35 int y1);
36
Initial commit: V -> Flutter FFI plugin ad0ccda nandi 11h ago37#ifdef __cplusplus
38}
39#endif
40#endif // VFLUTTER_H