Header translating. A bit long
From: Nikola Jankovic (news_jn_at_yahoo.com)
Date: 10/31/03
- Next message: B.r.K.o.N.j.A.: "Re: Which report tool?"
- Previous message: Maarten Wiltink: "Re: Which report tool?"
- Next in thread: Rob Kennedy: "Re: Header translating. A bit long"
- Reply: Rob Kennedy: "Re: Header translating. A bit long"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Oct 2003 12:33:06 +0100
I've been translating headers for libsndfile
(http://www.zip.com.au/~erikd/libsndfile) to Delphi/Object Pascal, and I
think I'm almost there, thanks to Robert Marquardt (Team JEDI).
The last thing to check is to see if the structs/records are packed or not.
I've written progs in Delphi and in C to output the sizeof of the
structures. I got the same results (for Delphi and C), but I must admit
that I don't understand completely the results.
There are 4 records:
1)
SF_INFO = record
frames: int64;
samplerate,channels,format,sections,seekable: integer;
end;
Total of 5x4B + 8B = 28B and sizeof gives 32. Probably because the default
alignment is 8 in both langs (4 added bytes are at the _end_ of the
structure (I've written some my values and output the structure to the
file, tried that in C, using original header file). So, added bytes for the
alignement are added to the end of the structure, to the last field?). This
is non-packed?
2) and 3)
SF_FORMAT_INFO = record
format: Integer;
name, extension: PChar;
end;
SF_DITHER_INFO = record
type_: Integer;
level: Double;
name: PChar;
end;
These two I'm not sure about since they give sizes of 12 and 24
respectively. 3x4 and 4+8+?
4)
SF_EMBED_FILE_INFO = record
offset, length: sf_count_t;
end;
Delphi help: "If two fields share a common type specification,
they are packed even if the declaration does not include the
packed modifier and the record type is not declared in the
{$A-} state." Does C do the same thing? Sizeof gives expected 16 anyway.
So my question really is which of these are packed and which are not?
Thanks in advance
Nikola
- Next message: B.r.K.o.N.j.A.: "Re: Which report tool?"
- Previous message: Maarten Wiltink: "Re: Which report tool?"
- Next in thread: Rob Kennedy: "Re: Header translating. A bit long"
- Reply: Rob Kennedy: "Re: Header translating. A bit long"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|