Thanks Corey, that should help.

Phil.

----- Original Message -----
From: Corey Murtagh

>From what I understand of structure alignment, it only pads the structure
when a member would be placed somewhere that isn't an even multiple of its
own size, or the alignment value whichever is smaller.  So that structure
should have offsets 0, 2 and 4 for Degree, Minute and Second respectively
and a size of 8 bytes.

Assuming structure alignment is 4:

struct SExample
{
  short foo;
  int bar;
};

...will have a size of 8 bytes, with offsets of 0 and 4 for foo and bar
respectively.

Hope this helps.

--
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur."

----- Original Message -----
From: Phil Middlemiss

Hi all,

how do I determine which alignment to choose for a record that will be sent
to a DLL compiled from C++ ? I have the source code for a test app that uses
the DLL but I don't know enough of C++ to work out how to send a record to
it. Here is a typical structure:

typedef struct EscCoordinateTag
{
 short Degree;
 short Minute;
 float Second;
} ESC_COORDINATE, *LPESC_COORDINATE;

Some structures contain other structure types also.


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to