DDE between 32-bit Delphi and 16-bit Pascal

I have discovered a 'feature' of using the DDEML to communicate
between Delphi 2 and old 16-bit programs. (Note: I am NOT using
Delphi's DDE components as they only seem to allow the passing of text

I have a Delphi program at which data is entered, then the data is
passed via DDE to a 16-bit (Borland Pascal) program for further

Now, both the Delphi and the Borland Pascal program obtain the data
structure from a separate unit in which a record is defined. This
record is something like this:

                SharedData = record
                        ID: word;
                        DataType: Byte;
                        AFlag: boolean;
                        Channel: Longint;
                        Modifier: array [1..5] of byte;
                        DataLength: Longint;
                        Data: array [1..200] of byte;

What I found was that Delphi 2 and Borland Pascal appear to store this
record in different ways. As DDE relies on one program writing the
variable into memory in a format the second program can understand,
the fact that the Pascal and Delphi compilers store this structure
differently means that DDE falls over.

Specifically it appears to be the 'Longint' fields that cause the

I've fixed the problem by using 'Word' fields instead of Longints, but
I'd be interested to know if anyone has any comments.

Duncan Fortune
Satellite Systems Consultants
Guildford. UK.