[Lazarus] Where is the System Unit source?
Sven Barth
pascaldragon at googlemail.com
Thu Nov 15 06:25:42 CET 2012
On 14.11.2012 19:19, Curt Carpenter wrote:
> Hello Sven.
>
> I understand now. I am using lazarus, which uses 4-byte integers.
While it might be true that you are using Lazarus this is not directly
the answer to my question. ;) At the top of a unit or program in Free
Pascal there is usually a "$mode blabla" directive where normally
"blabla" is either "objfpc" or "delphi" (other modes are possible). If
no mode directive is given than the default is used which is "fpc"
normally except you pass a corresponding command line parameter (which
Lazarus does and which you can influence through the Compiler Settings
(page "Parser").
Nevertheless you said that you use a mode where SizeOf(Integer) = 4. In
that case it is incorrect to expect Byte values:
var
loval, hival: Byte;
begin
loval := Lo(SomeInt);
hival := Hi(SomeInt);
end;
Lo/Hi of a 4 Byte value will give the lower and higher Word (16 Bit)
value not a 8 Bit value. So if you have this value: $12345678 you will
get $1234 and $5678 by Lo/Hi and loval and hival will both contain the
Lower value ($34, $78) respectively.
I hope this helps you in finding the problem.
Regards,
Sven
More information about the Lazarus
mailing list