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

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


On Fri, 2 Aug 2002, Florian Klaempfl wrote:

> At 12:41 02.08.2002 +0200, you wrote:
>
>
> >On Fri, 2 Aug 2002, Jonas Maebe wrote:
> >
> > >
> > >
> > > On Fri, 2 Aug 2002, Full_Name wrote:
> > >
> > > > One other point.. surely the interface is there just for the
> > > > convenience of the developer - like a C header file.
> > >
> > > No, it's mainly to guarantee portability between different compiler
> > > versions. The problem is that the ppu files are compiler versino
> > > dependent, so if you want to distribute a unit without the source, you
> > > have to re-distribute it every time a new compiler version is released (if
> > > the ppu format has changed at least), which is not very nice. With the
> > > interface-only units, you distribute an object file and an interface and
> > > people can use the unit, no matter which versio of the compiler they use
> > > (in theory at least :)
> >
> >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.
>
> If the system unit gets a new type/var/proc/...or even if you
> reorder the source code of the system unit the indizies for
> some system unit ppu entries change => ppus compiled with older systems
> unit doesn't work anymore though neiter A. nor B. apply :)

So you're only my case stronger =-)

>
> >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.
> >What is more, you can easily make o an 'interface-only unit' now. The
> >easy way is to have all functions in a separate object file and create
> >a unit that just contains the needed definitions.
> >This is already possible as follows:
>
> But it doesn't work flawless with objects and classes etc. I think
> and you've to maintain to sets of interfaces or you've to use
> lot of ifdefs...

But the same is true for interface-only units, so you're in trouble
in any case...

My conclusion is that interface-only units are useless, and not worth
the effort.

Michael.





More information about the fpc-pascal mailing list