[fpc-devel] CmdLine

Yury Sidorov jura at cp-lab.com
Sun Oct 22 19:57:16 CEST 2006


From: "Daniƫl Mantione" <daniel.mantione at freepascal.org>
> > I already implemented optimization of CmdLine for smartlinking for WinCE some
> > time ago. It is controlled by HAS_CMDLINE define. And CmdLine is declared as
> > function in WinCE system unit.
> >
> > CmdLine as property will be great, but I found that property getter/setter
> > need to be declared before property declaration in the interface part. This
> > will garbage a global namespace with private getters/setters.
> >
> > Is it possible to make compiler to accept getters/setters not declared in the
> > interface part, but implemented in the implementation?
>
> I think it is not so easy, because the actual implementation (variable,
> function), affects code that uses the property. The implementation part of
> the unit does not necessarily have already been compiled when the unit is
> used.

I see the following way to implement it:

For example the compiler was found the following declaration of global propery:

property DrawMode: integer read GetDrawMode write SetDrawMode;

If GetDrawMode and SetDrawMode was not declared before, the compiler assumes that declaration is standard:

procedure SetDrawMode(const Value: integer);
function GetDrawMode: integer;

The compiler can internally declare setter and getter and mark them like compilerproc (or in other way) to hide from global 
namespace.

Yury Sidorov.



More information about the fpc-devel mailing list