[squeak-dev] Re: [FFI] Endless C structs and unions
Andreas Raab
andreas.raab at gmx.de
Mon Mar 30 17:49:02 UTC 2009
Hernán Morales Durand wrote:
> I have a couple of questions, I started to play with FFI, so these
> are newbie ones, my intention is to port the ZOOM library. I was there
> happily writing ExternalStructure's until I found one that kills the
> VM. Then I've realized I have some basic doubts about FFI:
> ZOOMODR class>> fields
> " self defineFields "
> ^ #(
> (direction 'long')
> (error 'long')
> (buf 'char *')
> (top 'long')
> (size 'long')
> (pos 'long')
> (bp 'char *')
> (mem 'ZOOMNMem')
> (odrPrivate 'void *') " ========= HERE ========= "
> )
>
> I don't know if this exists, the HERE means
Yes, this will work fine.
> 2)
> Z_NamePlusRecord Struct Reference
> =================================
> Z_DatabaseName * databaseName
> int which
> union {
> Z_External * databaseRecord
> Z_DiagRec * surrogateDiagnostic
> Z_FragmentSyntax * startingFragment
> Z_FragmentSyntax * intermediateFragment
> Z_FragmentSyntax * finalFragment
> } u
>
> Is there something special to do about an union in the #fields method?
Just declare it as any pointer you'd like and provide methods for the
particular conversions you need.
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|