TL;DR Is it possible to use C code to implement the (un)pickling of an type written in a C extension, as it was written in _pickle.c?

Long explaining: I'm trying to create a C extension for frozendict. For simplicity, first I wrote it in CPython, then I started to move it in a C extension. It seems to work, but I have to move the code I wrote in _pickle.c and in the C extension. Is it possible, or I have to create a slower `__reduce_ex__` method that simply converts it to dict?

This is, for example, the C code for pickling frozendict in _pickle.c: