[fpc-pascal] units order (was using oldlinux )

Vincent Snijders vsnijders at quicknet.nl
Tue Jun 14 10:07:42 CEST 2005


Alain Vitry wrote:
> 
> Le 14 juin 05, à 09:46, Michael Van Canneyt a écrit :
> 
>>
>> You must switch the order of the units, because you get the 'oldlinux' 
>> types which
>> you try to use in 'baseunix' functions.
>>
>>
> This unit order trick is a bit of a wizardery to me. It quickly get very 
> messy in a large enough program to swap units order until you get the 
> one which doesn't break.
> In the sw I'm porting, almost every single UPI type is re-defined in 
> many units, which makes FPC complain about types.
> Am I missing some switches or some pascal features, with my kernel 
> hacker mind ?
> 

You can also specify from which unit you want to use the 
type/procedure/function/constant.

Suppose both unit A and unit B declare a procedure DoIt;

You could do something like this:
program p;

uses A, B;
begin
   A.DoIt; // calls DoIt in unit a
   B.DoIt; // calss DoIt in unit b
end;


Vincent.




More information about the fpc-pascal mailing list