Improved struct module

Robin Boerdijk robin.boerdijk at nl.origin-it.com
Thu Oct 14 14:47:43 EDT 1999


> Curiously enough, I hardly ever muck with C structs.  I too would like to
> hear from people who do!  I only jumped in here because I thought you had
> written a very interesting module, and your announcement was followed by
> days of silence.  You may not like the approach I've taken here, but it
has
> gotten the module some much-needed publicity <wink>.

Thanks for that Tim. I must admit that I am also one of those lazy bastards
that uses his newsreader's "find any messages by Tim Peters"-function to
locate interesting threads. Anyway, I will stop pushing the xstruct module
and leave it as it is (will improve the docs). I have one concern left
though: Just like I overlooked Just's sstruct module, people will overlook
this module (and start implementing something similar themselves, like I
did). If we can't get modules like this into the core Python distribution,
could there be links from the Python documentation to point to these
'improved' modules ?

> [about the buffer interface]

I do want to come back on the buffer interface though. I think I have no
alternative for using it. How else can I encapsulate a C API function that
expects a pre-allocated buffer as a parameter.

For example, how could I encapsulate the following C function:

    int GetMessageFromQueue(void* buffer, int bufsize);

where buffer is an application supplied buffer of size bufsize. The function
will return the part of the buffer actually filled. The only one who knows
what a reasonable size of the buffer is is the application programmer (who
is programming in Python).

Robin.






More information about the Python-list mailing list