/* A rough estimate of the FFI API as written in C */ #include #include #include struct Vector3 { float x; float y; float z; }; struct StringMap { char** keys; char** values; size_t count; }; struct GeometryOutput { struct Vector3* vertices; size_t vertex_count; size_t* indices; size_t indices_count; }; struct ProcessResult { struct GeometryOutput geometry; struct StringMap map; }; void free_process_results(struct ProcessResult* result) { for (size_t i = 0; i < result->map.count; i++) { free(result->map.keys[i]); free(result->map.values[i]); } free(result->map.keys); free(result->map.values); free(result->geometry.vertices); free(result->geometry.indices); } struct ProcessResult process_geometry(const struct Vector3* vertices, size_t vertex_count, const size_t* indices, size_t indices_count, const struct StringMap* config) { printf("C: Received config of size: %zu\n", config->count); struct ProcessResult result; // Simulate some processing and populate the result structure return result; }