Martin, hats off!
This does exactly what I want, and it does so in a pretty generalized way. Actually in _such_ a generalized way that I think this should be documented loud and clear.
Looking at it a bit more, how about storing each function pointer in a separate PyCObject, and adding general APIs somewhere in the core void PyType_SetAnnotation(PyTypeObject *tp, char *name, char *descr, void *); void *PyType_GetAnnotation(PyTypeObject *tp, char *name, char *descr);
I'll happily add that to some recipe collection. However, before generalizing it, I'd like to see more use cases. There should, atleast, be a *second* application beyond calldll (or, perhaps even beyond MacPython). Generalizing from a single use case is not good.