[Python-Dev] ctypes: Configurable bitfield allocation strategy

Vlad Riscutia riscutiavlad at gmail.com
Mon Jun 27 02:48:23 CEST 2011


Well it's not really layout, because alignment is handled by pack option. It
is how the field gets allocated. At this point I believe it will be more
complex to come up with custom allocation option, precisely because it's up
to each compiler to allocate the structure. Such flexibility will add a lot
of complexity and it might not payoff. This is debatable, but I would go
with a 3 option strategy at this point - native, GCC, MSVC and if we
actually find interop issues with other compilers we can look into custom
allocation.

I will try to refactor the C code to more easily accommodate a mode option
(while leaving behavior the same for now), then we can decide how the
library interface should look like.

Thank you,
Vlad

On Sat, Jun 25, 2011 at 4:37 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>wrote:

> Vlad Riscutia wrote:
>
>> Longer term though, I think it would be better to add a property on the
>> Structure class for configurable allocation strategy, for example Native
>> (default), GCC, MSVC
>>
>
> It could also be good to have a mode which lets you specify
> *exactly* how the bits are laid out, independent of any
> particular compiler.
>
> --
> Greg
>
> ______________________________**_________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/**mailman/listinfo/python-dev<http://mail.python.org/mailman/listinfo/python-dev>
> Unsubscribe: http://mail.python.org/**mailman/options/python-dev/**
> riscutiavlad%40gmail.com<http://mail.python.org/mailman/options/python-dev/riscutiavlad%40gmail.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110626/e3983c5e/attachment.html>


More information about the Python-Dev mailing list