sinnatagg wrote:Is it the case that the defcstruct name can be arbitrary and is not referenced against the exported c symbols?

I am reasonably sure that this is in fact the case. CFFI in general doesn't enforce type safety of foreign data, you can refer to any piece of memory you own as any type. And C doesn't export structure layouts anyway (as a standard, I googled a bit and maybe Windows DLLs, but the information seems confused), so there wouldn't really be any point in referencing those symbols.

Natively, there is nothing like type safety when calling C code. That's why each piece of C code that needs to use a shared library (for instance dll) needs the header file with the function definitions and type definitions.No such information is exported from the shared library; only the entry-point name and/or ordinal number to be able to refer to the right function, but nothing of the function signature is conveyed.