help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] CStruct ABI and packed structs


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] CStruct ABI and packed structs
Date: Sun, 06 Jun 2010 09:35:47 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b2pre Thunderbird/3.0.4

On 06/06/2010 04:56 AM, Holger Hans Peter Freyther wrote:
On 06/06/2010 10:48 AM, Holger Hans Peter Freyther wrote:


2.) The structs I showed are all packed and should not follow the
alignment rules...

This also creates the need for the #value selector to deal with
unaligned memory access... for architectures that need it.

Apart from this, the packed struct class would simply be

^L
CCompound subclass: CPackedStruct [

    <shape: #word>
    <category: 'Language-C interface'>
    <comment: nil>

    CPackedStruct class >> declaration: array [
        "Compile methods that implement the declaration in array."

        <category: 'subclass creation'>
        self
            declaration: array
            inject: self superclass sizeof
            into: [:oldOffset :alignment | oldOffset]
    ]
]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]