[fpc-devel] Patches
Michael Van Canneyt
michael at freepascal.org
Thu Sep 30 18:39:55 CEST 2010
On Thu, 30 Sep 2010, Adem wrote:
> On 2010-09-30 18:07, Michael Van Canneyt wrote:
>>> Actually, if I were DoDi, I'd probably bring all those units (that do
>>> nothing but declare various types and constants) in the uses secions of
>>> globals.pas into globals.pas. I don't see why bringing together all the
>>> globals together should make everything dependent on everything else;
>>> after all 'globals' are those variables/routines that are common to all.
>> I think there is a misunderstanding: 'global variables' <> 'globals'.
> True. 'Globals' include 'global variables', structures and routines.
>
>> He meant variables that are not part of an object, but declared as a unit
>> variable. If you put all such 'global' variables in 1 unit, you do drag in
>> all the original units, if the variables are typed.
> I checked the following units used in globals.pas.
>
> -- version.pas
> Uses no external units. Comprises of a few type/constant declarations.
>
> -- globtype.pas
> Uses no external units. Comprises of a few type/constant declarations.
>
> -- systems.pas
> Uses some external units, all except one is already used in globals.pas.
> The only extra unit is {$ifdef FreeBSD},SysCtl,{$endif} which could easily
> be added to the uses section (or the body) of globals.pas.
>
> -- cpuinfo.pas
> Uses no external units. Comprises of a few type/constant declarations.
>
> IOW, all these units could be combined into globals.pas
You still don't understand.
take the unit export. It contains:
var
CExportLib : array[tsystem] of TExportLibClass;
ExportLib : TExportLib;
If you want to move the *global variables* (as in: unit scope)
CExportLib,ExportLib to globals, you must add export to the globals unit.
Michael.
More information about the fpc-devel
mailing list