Bad initialization code for units
Original Reporter info from Mantis: laaca@seznam.cz
-
Reporter name: Ladislav Lacina
Original Reporter info from Mantis: laaca@seznam.cz
- Reporter name: Ladislav Lacina
Description:
It seems that compiler (at least the GO32V2) produces bad initialization code for units. Look at the source. This problem affects f.e. units Graph and MSMouse
Additional information:
------------------------------- TEST.PAS ---------------------------------
uses crt,{any unit-doesn't matter which one. But must be listed as first}
unit1; {musn't be listed as first}
begin
writeln(l); {should write 14 but writes 0}
readln;
end.
--------------------------------------------------------------------------
{-------------------------------- UNIT1.PAS ---------------------------------}
unit unit1;
interface
var l:longint;
implementation
uses unit2;
begin
InitMouse;
l:=14; {some value}
end.
--------------------------------------------------------------------------
{-------------------------------- UNIT1.PAS ---------------------------------}
Unit unit2;
Interface
Procedure InitMouse;
Implementation
Procedure InitMouse;assembler;
asm
xor eax,eax {it is somewhat related to code in this procedure}
int 33h {f.e. "mov eax,3; int 10h" is OK}
end;
Begin
{write(''); This is interresting - if you uncomment it, problem disappears}
InitMouse;
End.
--------------------------------------------------------------------------
Mantis conversion info:
- Mantis ID: 7338
- Platform: go32v2