Getting sizes and alignments via ctypes stubgen

Hi,

We are using the ctypes stub generation (shamelessly ripping off @avsm’s YAML binding) to bind to libmaxminddb. This works fine but to allocate the space for a MMDB_s we need the size and alignment. Currently we have hand-written functions to which we compile in the stubs like this and then bind like that but this is a rather roundabout way and I believe there has to be some way to get the ctypes stub generator to write these stubs for us and give us the value to ML-land.

Does anyone know the magic incantation necessary to get this automated?

Why is this a special case? I think you can just use the stubgen to query the size of the struct and it will do the right thing in the generated code. I don’t quite have time to look at it now in detail, but open a ctypes issue if you can’t figure this one out and I can look later.