R
Robert Feldt
Hi,
So trying to distill the recent thread about C compilers
alignment/layout of nested structs it appears that:
* Ruby/DL cannot as of now handle structs within structs.
* A trick to get around that is to inline the inner struct
into the outer struct.
* If we could assume this trick work in general we could
enhance Ruby/DL to handle nested structs.
* The trick relies on how different C compilers lays out
a struct in memory. The ANSI C standard does not specify
how that should be done; its implementation-defined ie.
each compiler must document how they do it but it may
not be in the same way.
* This means problem for us when trying to use Ruby/DL
for libs that have nested struct constructs.
So the situation look grim; even if we find a portable
way to check how a certain compiler lays things out
it may not lay things out in the same way for different
structs. There could be special situation where it changes the layout.
So is there anything we can do?
If not this sounds like a serious problem for using
Ruby/DL on larger/more complex lib "wraps".
Regards,
Robert Feldt
So trying to distill the recent thread about C compilers
alignment/layout of nested structs it appears that:
* Ruby/DL cannot as of now handle structs within structs.
* A trick to get around that is to inline the inner struct
into the outer struct.
* If we could assume this trick work in general we could
enhance Ruby/DL to handle nested structs.
* The trick relies on how different C compilers lays out
a struct in memory. The ANSI C standard does not specify
how that should be done; its implementation-defined ie.
each compiler must document how they do it but it may
not be in the same way.
* This means problem for us when trying to use Ruby/DL
for libs that have nested struct constructs.
So the situation look grim; even if we find a portable
way to check how a certain compiler lays things out
it may not lay things out in the same way for different
structs. There could be special situation where it changes the layout.
So is there anything we can do?
If not this sounds like a serious problem for using
Ruby/DL on larger/more complex lib "wraps".
Regards,
Robert Feldt