[fpc-pascal] What's a unit?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Feb 19 15:24:44 CET 2013


ik wrote:
> On Tue, Feb 19, 2013 at 3:31 PM, Mark Morgan Lloyd
> <markMLl.fpc-pascal at telemetry.co.uk> wrote:
>> Does a unit- rather than something it contains- have any sort of
>> representation which is recognisably distinct from an object?
>>
>> I've got a situation where if a library (.dll or .so) is opened under
>> program control it is represented by an object, with entry points expressed
>> as methods. Alternatively, if it's statically linked then it's represented
>> by a unit, with entry points represented by procedures and functions. That
>> allows me to write things like
>>
>> caps := LibCapShim.cap_get_proc;  // LibCapShim is object or unit
> 
> It's a namespace. It can be a namespace of a unit, record, instance of
> class or object.

Which I presume is a concept valid only within the compiler, and even if 
it were accessible in some way would be little better than a conditional 
directive.

-- 
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