[fpc-pascal] What's a unit?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Feb 19 18:43:02 CET 2013

Sven Barth wrote:
> On 19.02.2013 18:08, Mark Morgan Lloyd wrote:
>> Sven Barth wrote:
>>>> Thanks Sven, looks interesting and I'll play with it presently. Can an
>>>> extended record's fields/methods be set up at compilation time, or do
>>>> they need to be done by code?
>>> The example I've given was for the case that you load the functions
>>> dynamically and use the procvars contained in the record. You could do
>>> it this way as well:
>> Yes, that's pretty much what I'm already doing (courtesy of somebody's
>> Delphi NAG bindings). But what about the static case, i.e. can an
>> extended record be exposed as a constant in an ordinary unit (no DLLs
>> etc. involved) with the methods preinitialised?
> Yes, that will work. You can even initialize private fields (though I 
> don't know whether it needs to be in the same unit in that case...).

Thanks, I'll experiment.

I'm surprised that somebody hasn't jumped on me and said that my error 
checking's lousy: in fact there's plenty of checking in there but since 
the code in question is being run early during a program's startup 
(during which it might briefly be setuid root) any problems are being 
noted for later display and worked around as far as possible.

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-pascal mailing list