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

Jonas Maebe jonas at zeus.rug.ac.be
Thu Aug 1 20:54:23 CEST 2002

On Wed, 31 Jul 2002, Nikolai Zhubr wrote:

> > This was discussed recently (not on a public list though) and we decided
> > we'd probably implement this the way Virtual Pascal already supports it
> > (so that not yet another syntax has to be invented). No-one started
> > working on this yet though.
> Great!
> Could you give some refs so that I could find out how this will
> probably look like?

Here's a mail from someone that explains it:

> Just an idea:
> What about about supporting "interface only" units? The unit comes
> with the interface in pascal source but the implementation is left
> away, it comes with an .o file which was compiled out of the whole
> unit source.
> Syntax example:

 If we do it (and I think it's a good idea, in fact), I'd suggest to
do it in VP compatible way. Quoting from VP documentation about
$PureInt compiler directive (note - VP supports & as yet another
prefix for compiler directives in addition to $):

&PureInt (Switch: Default=&PureInt- Type=Global)
Forces a unit to be a pure interface unit. To supply a unit's object
code without source code and be sure that it works even if the format
of the .VPI files changes, a pure interface unit for should be
created. To do this, it must contain {&PureInt+} directive at the
start of the unit and the entire interface part of the unit. The
implementation part of the unit should be removed, except for the
uses clause (if applicable). If the unit has an initialisation part,
the initial begin should be included as well:





If no initialisation part is present, the begin should be left out:




The {&PureInt+} directive forces the compiler to ignore undefined
forward references to procedures, functions and methods and assume
that they are implemented in the original version of the unit, in the
form of a .OBJ or .LIB file. No object file or library is generated
for a pure interface unit, meaning that a newer version of the
compiler can be used to create an appropriate .VPI file for it and
still use the object file or library produced from the original unit
by the old version of the compiler. In the default {&PureInt-} state,
a unit is assumed to implement the interface part as usual.
Note: Those parts of the Virtual Pascal Run-Time Library that are
derived from source code copyrighted by Borland Int are supplied as
Pure Interface units; the full source code is supplied as upgrade
patches that requires the original source code to be available.


 Not that it would really matter, but why to invent something


More information about the fpc-pascal mailing list