hpy
hpy copied to clipboard
Autogen: separate API and ABI
I’m running more and more into the situation where we want to add user-visible API functions (e.g. HPyCapsule_GetContext
ind PR #308 ) but map them to a more generic context function (e.g. ctx_Capsule_Get
).
The current autogen tool does not directly allow to do so. The more generic context function will also be exposed as API function.
I’m thinking of having a public_api.h
and a context_abi.h
file. Then it would be possible to define an (optional) mapping between API and ABI functions in, for instance, conf.py
. The default behavior would still be that a function in public_api.h
would also define an ABI function if no custom mapping was specified.
Reasons for my request are:
- In the docs, we state that the full API is defined in
public_api.h
but that’s actually no longer true. We already have macros/functions likeHPy_New
/_HPy_New
. - We can write custom API functions in
misc.h
/misc_trampolines.h
(which don’t show up inpublic_api.h
, ofc) but we still need to define something inpublic_api.h
which will be both API/ABI but sometimes this function isn’t meant to be used directly but is still exposed. - No debug wrapper will be generated for custom trampolines in
misc.h
/misc_trampolines.h
.