Map foreign Arrow C Data Interface struct pointers to void *#27
Open
estebanzimanyi wants to merge 1 commit into
Open
Map foreign Arrow C Data Interface struct pointers to void *#27estebanzimanyi wants to merge 1 commit into
estebanzimanyi wants to merge 1 commit into
Conversation
The Arrow C Data Interface structs (ArrowSchema, ArrowArray) are forward-declared, layout-less foreign types with no MEOS semantics, so a pointer to one is ABI-identical to void *. Emitting them as void * lets every binding's existing opaque-pointer-family handling wrap them uniformly instead of each generator needing an Arrow-specific case: a permissive generator maps an unrecognised pointer to a raw pointer, while a conservative one skips it. Normalise struct ArrowSchema * / ArrowArray * to void * in the declared and canonical spellings, mirroring the existing _Bool -> bool normalisation. Add a generation-time guard that warns when a forward-declared foreign struct pointer appears in the API but is not listed, so it is classified explicitly rather than diverging silently per binding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Arrow C Data Interface structs (
ArrowSchema,ArrowArray) appear in the MEOS public API only at the FFI boundary. They are forward-declared, layout-less foreign types with no MEOS semantics, so a pointer to one is ABI-identical tovoid *.Currently the extractor emits them verbatim as
struct ArrowSchema */struct ArrowArray *, and the downstream generators diverge: a permissive generator (JMEOS) maps an unrecognised struct pointer to a rawPointerand the Arrow functions bind, while a conservative one (GoMEOS) treats it as an unsupported shape and skips the function. Someos_*_to_arrow/meos_*_from_arrowreach some bindings but not others.This normalises
struct ArrowSchema */struct ArrowArray *tovoid *in both the declared and canonical spellings — mirroring the existing_Bool -> boolnormalisation in the same two spelling helpers — so every binding's existing opaque-pointer-family handling (Pointer,_ffi.CData,unsafe.Pointer,IntPtr,*mut c_void) wraps them uniformly, with no per-generator special case. The idiomatic Arrow bridge stays in each binding's hand-written layer, keyed off the*_to_arrow/*_from_arrowfunction name, as with any other opaque-pointer-family value.It also adds a generation-time guard (
find_unlisted_foreign_structs) that warns when a forward-declared foreign struct pointer appears in the API but is not listed in_EXTERNAL_OPAQUE_STRUCTS, so a future external type is classified explicitly instead of diverging silently per binding. The guard distinguishes foreign structs (only ever elaborated,struct X *) from typedef'd MEOS types (also appear bare,Pose *), so MEOS types are never flagged.Verified with the GoMEOS generator: before,
meos_temporal_to_arrowand siblings emit// TODO unsupported param struct ArrowSchema *; after the normalisation, they generate asfunc MeosTemporalToArrow(temp Temporal, out_schema unsafe.Pointer, out_array unsafe.Pointer) bool.