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

Jonas Maebe jonas at zeus.ugent.be
Tue Jun 14 11:13:44 CEST 2005


On 14 jun 2005, at 10:45, Alain Vitry wrote:

> I know about unit propagation.

Note that FPC at this time does not support uses propagation, so only  
the types exported directly by the units in the uses clauses of the  
current compilation unit are visible.

> PicHandle is first defined in MacWindows, then used in standardfile.

It is also defined in standardfile, because standardfile includes  
dialogs.p which in turn includes quickdraw.p, and PicHandle is  
defined in quickdraw.p

> The best solution I've found is to suffle units around, altough I  
> find this approach inelegant.

So is the fact that these types are redeclared in all units over and  
over again. I think the easiest solution would be to replace all  
those units by "carbon". Then everything is defined in one unit and  
you shouldn't have any further problems with this anymore.

> Shouldn't type A defined in unit X be fixed whether units Y, Z who  
> also use it are included or not in my program ?

That is the case. The problem is simply the C-like inclusion of  
Pascal "header" files by which the Universal Interfaces are plagued.  
In C, you do not have namespaces so it doesn't matter. This is  
different for Pascal. But if you simply use the carbon unit  
everywhere, you won't have this problem.


Jonas




More information about the fpc-pascal mailing list