[fpc-pascal]Interface-only units (was: shared libraries interface)

Michael Van Canneyt michael.vancanneyt at wisa.be
Fri Aug 2 15:24:10 CEST 2002

On Fri, 2 Aug 2002, Nikolai Zhubr wrote:

> Hi
> Friday, 02 August, 2002, 14:41:38, Michael Van Canneyt wrote:
> > I don't see the use of such a construct:
> > A. If the internal naming conventions of the compiler change,
> >    chances are that the object file is useless anyway.
> > B. If the internal alignment rules for constants, sets, records and
> >    I don't know what change, then you're stuck as well.
> > Since with a new compiler version, you are not guaranteed that these
> > things have not changed, this rather defeats the purpose of the unit as
> > you will be forced to redistribute anyway.
> > So I see no real use for a 'interface-only' unit.
> Ok. First, traditional "wrapper" units like your example get
> not that good-looking if there are 1000 or more externals
> to declare, and in case that full pascal source is available,
> <U> which i'm only talking about </U>, it is just kind of source
> code duplication, it looks not elegant, it is an additional
> source of typos and bugs, and it does not seem to really provide
> *something* that would be essentially missing from the project
> otherwise (In the case of *pure* pascal project with full source
> available)

I didn't claim all that, of course
I just don't see the point of the interface-only unit.

> But actually I was thinking about some different point when
> I asked. That is, about how to put some classes implementation
> into a library (preferrably shared one). The example below won't
> help much here :(.

in my opinion, there is no good way to do that.
Only interfaces or packages à la Delphi will allow you to do this.

> BTW, now I've got an impression that VP's approach is only
> good for hiding sources. Well, it wasn't designed for anything
> else.

But you don't need interface-only units for that ?
Simply don't distribute the sources.
Strip the interface part and distribute it together with the .ppu.
You must do that anyhow for almost each compiler version.
(hopefully I demonstrated that convincingly enough) , so...


More information about the fpc-pascal mailing list