Skip to content

Native Interface (NI) #1

@encukou

Description

@encukou

Let's add a brand new API layer called the Native Interface (NI) that is:

  • performant
  • complete (provides all necessary building blocks)
  • meant as a base for another layer (C-API, Cython, other language bindings)
    • not ergonomic (for C)
    • can use unwieldy names with version information or argument types
  • "ABI" only -- no C macros, inline functions, compiler-dependent types, etc.

Then, let's build a C-API layer on top of that, as one of many possible layers: things like Cython, PyO3, ctypes.pythonapi would act as alternatives to C-API (and reimplement it).

The C-API layer would implement the current C-API (Limited API at first), and would consist of

  • thin wrappers around the NI, autogenerated from a description that's easy to reuse for the other layers
    • the description would encode similar info as Argument Clinic: argument/return types of a C wrapper and of the called NI function, and how to convert from one to the other
  • optional hand-written wrappers that can reach into the internals for performance
    • these should have the same API as the above, and automatically replace them the above is a stable ABI is not needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions