Hello all,

I take back my previous mail, that the packed record doesn't use the
same order as it is definition. I am in time hurry and made on error,
that I was exporting the content of similar record to file to compare
and therefore I looked me as wrong one.

So it is solved.

TRoland;

<<< 28.4.2009 15:23 - Roland Turcan "k...@rotursoft.sk" >>>
RT> <<< 27.4.2009 19:26 - Mattias Gaertner "nc-gaert...@netcologne.de" >>>
MG>> Use packed records and add gap variables.

RT> Uffff, look at this:

RT> TYPE TPackedGap =PACKED RECORD
RT>                    VarInteger :INTEGER;
RT>                    Dummy1     :INTEGER;
RT>                    VarDouble  :DOUBLE;
RT>                    VarBoolean :BOOLEAN;
RT>                    VarBoolean2:BOOLEAN;
RT>                    Dummy2     :Word;
RT>                    Dummy3     :INTEGER;
RT>                  END;


RT> ... and I would expect, that the binary representation of this
RT> definition will keep the order of variables from definition, but it
RT> doesn't.

RT> Could somebody explain what rules is applied to change the order of
RT> variables in memory?

RT> TRoland;

RT> <<< 27.4.2009 19:26 - Mattias Gaertner "nc-gaert...@netcologne.de" >>>
MG>> On Mon, 27 Apr 2009 17:27:30 +0200
MG>> Roland Turcan <k...@rotursoft.sk> wrote:

>>> Hello Dmitry,
>>> 
>>> Thanks for your reply, but I think, that you haven't understood me
>>> what I am trying to explain.
>>> 
>>> I have binary contents which are copied from memory using by an
>>> application which is written in Delphi. I am porting an application to
>>> MacOS X 10.5, but I need to use the same structures as I have in
>>> Delphi and Kylix where "NOT PACKED" records are aligned.
>>> 
>>> The fact is, that FPC compiler on intel based Mac OS X builds up
>>> application which contains records "packed" by 4 bytes by default.

MG>> Use packed records and add gap variables.

MG>>  
>>> I need to get the same behavior in intel based mac os x as I have in
>>> other platforms.
>>> 
>>> What should I do to build FPC compiler which will behave the same on
>>> all platforms.

MG>> This won't work. The other sources and libs expect another alignment.
MG>> FPC uses the various alignments for good reason.


MG>> Mattias
MG>> _______________________________________________
MG>> Lazarus mailing list
MG>> Lazarus@lazarus.freepascal.org
MG>> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus








-- 
Best regards, TRoland
http://www.rotursoft.sk
http://exekutor.rotursoft.sk

_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to