Skip to content

Hold every declaration to a symbol MEOS exports - #21

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:ci/native-symbol-parity
Sep 2, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:ci/native-symbol-parity

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

A P/Invoke binds by name at the first call, so a function MEOS renames or
drops is invisible to the compiler and reaches a caller as an
EntryPointNotFoundException in production. A test resolves every entry point
the binding declares against the loaded library, which turns that into one
named failure with the symbols listed. It reads the declarations by reflection
over the LibraryImport attributes rather than from a list beside them, so a
declaration cannot escape it, and it refuses a run that reads fewer than a
thousand of them, since a parity check with nothing in its hand accepts
anything. A second test holds the check itself to a control: meos_initialize
resolves and meos_no_such_function does not.

Under that check the binding declares MEOS's own surface. The catalog marks
the declarations that reach it from a project MEOS vendors — pgPointCloud's
pc_api.h and hashtable.h, PostgreSQL's pg_numeric.h — and those are that
project's API rather than MEOS's: 150 declarations, every one of them internal,
and indexFor, pc_patch_sort and pc_patch_is_sorted among them are the
only three in the whole catalog that the built library never exports, the first
because a static inline in a header defines no external symbol at all. The
remaining 4675 functions across 26 headers each resolve.

A P/Invoke binds by name at the first call, so a function MEOS renames or
drops is invisible to the compiler and reaches a caller as an
`EntryPointNotFoundException` in production. A test resolves every entry point
the binding declares against the loaded library, which turns that into one
named failure with the symbols listed. It reads the declarations by reflection
over the `LibraryImport` attributes rather than from a list beside them, so a
declaration cannot escape it, and it refuses a run that reads fewer than a
thousand of them, since a parity check with nothing in its hand accepts
anything. A second test holds the check itself to a control: `meos_initialize`
resolves and `meos_no_such_function` does not.

Under that check the binding declares MEOS's own surface. The catalog marks
the declarations that reach it from a project MEOS vendors — pgPointCloud's
`pc_api.h` and `hashtable.h`, PostgreSQL's `pg_numeric.h` — and those are that
project's API rather than MEOS's: 150 declarations, every one of them internal,
and `indexFor`, `pc_patch_sort` and `pc_patch_is_sorted` among them are the
only three in the whole catalog that the built library never exports, the first
because a `static inline` in a header defines no external symbol at all. The
remaining 4675 functions across 26 headers each resolve.
@estebanzimanyi
estebanzimanyi merged commit c1ca150 into MobilityDB:main Sep 2, 2026
1 check passed
@estebanzimanyi
estebanzimanyi deleted the ci/native-symbol-parity branch September 2, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant