[Lazarus] EXC_BAD_ACCESS, Could not access memory

Roland Turcan konf at rotursoft.sk
Tue Apr 28 15:23:42 CEST 2009

<<< 27.4.2009 19:26 - Mattias Gaertner "nc-gaertnma at netcologne.de" >>>
MG> Use packed records and add gap variables.

Uffff, look at this:

                   VarInteger :INTEGER;
                   Dummy1     :INTEGER;
                   VarDouble  :DOUBLE;
                   VarBoolean :BOOLEAN;
                   Dummy2     :Word;
                   Dummy3     :INTEGER;

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

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


<<< 27.4.2009 19:26 - Mattias Gaertner "nc-gaertnma at netcologne.de" >>>
MG> On Mon, 27 Apr 2009 17:27:30 +0200
MG> Roland Turcan <konf at 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.

>> 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 at lazarus.freepascal.org
MG> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Best regards, TRoland

More information about the Lazarus mailing list