// C entry points for tests/test_arrow.py. // // The Python side cannot call the C++ builders, so each one is wrapped here and // the payload is passed in from the test rather than fixed in this file. #include "arrow/array.h" #include namespace { void hand_over(void* array, void* schema, const arrow_c::Exported& exported) { // The caller owns the two structs, exactly as dora does: it reads them and // is then responsible for releasing what they point at. std::memcpy(array, &exported.array, sizeof(exported.array)); std::memcpy(schema, &exported.schema, sizeof(exported.schema)); } } // namespace extern "C" { void zed_export_image(void* array, void* schema, uint32_t width, uint32_t height, const char* encoding, const uint8_t* data, size_t size) { hand_over(array, schema, arrow_c::image(width, height, encoding, data, size)); } void zed_export_float32(void* array, void* schema, const float* values, size_t count) { hand_over(array, schema, arrow_c::float32(values, count)); } void zed_export_string(void* array, void* schema, const char* text, size_t size) { hand_over(array, schema, arrow_c::string(text, size)); } } // extern "C"