Skip navigation.
 
mlRe: Struct introspection or information
FROM : Steve Christensen
DATE : Mon Nov 05 23:14:00 2007

On Nov 5, 2007, at 12:33 PM, Monitus wrote:

> Good day everyone - sorry if this is not totally Cocoa-related: if 
> there's a better list for this, please let me know and accept my 
> apologies in advance...
>
> Is there any way to know the fields in a C structure, if you don't 
> have the headers that define it?


No. The compiler uses a struct declaration to determine the type, 
size and offsets of each of its fields, as well as for determining 
the overall size of the struct itself. Once the C source is converted 
into assembly language instructions the field information is no 
longer needed.

> Or at the very least, is it possible to access it's field values?


If you're thinking it terms of a source debugger, no, since no 
symbolic information remains. You can certainly dump memory starting 
at the base address of the structure and try to figure out where the 
various fields are and what they might contain.

steve

Related mailsAuthorDate
mlStruct introspection or information Monitus Nov 5, 21:33
mlRe: Struct introspection or information John Stiles Nov 5, 21:57
mlRe: Struct introspection or information Steve Christensen Nov 5, 23:14
mlRe: Struct introspection or information David Spooner Nov 6, 01:34
mlRe: Struct introspection or information Steve Christensen Nov 6, 02:53
mlRe: Struct introspection or information Steve Christensen Nov 6, 19:28
mlRe: Struct introspection or information Steve Christensen Nov 6, 22:08