GPM???

Sun, 1 Jun 1997 19:45:28 +0200 (MET DST)


According to Bernhard Tschirren:
> 
> Im using GPC 2.0 (Alpha 9704??) with DJGPP 2.01. I noticed that a unit
> creates two files - One witht the extension GPI and another GPM. What is
> this GPM?

In fact it creates three files:

  - The `.o' file which contains the implementation part, functions and
    variables,

  - the `.gpi' file which contains the pre-compiled interface part, and

  - the `.gpm' files which serves the only purpose to tell which interfaces
    are implemented in the Unit.

The need for the `.gpm' file arises from Extended Pascal's Modules.  In a
UCSD-style Unit (like in Borland Pascal), you can always arrange it in a way 
that a Unit `Foo' - the identifier appearing after `uses' - is located in a 
file `foo.pas'.  With Extended Pascal, you don't include `Module Foo' but some 
interfaces defined in the module which usually don't have the same name:

    Module Foo Interface;

    Exports
      Bar = (some, identifiers, listed, here);

    end.

This will produce `foo.gpm' and `bar.gpi'.  (See the info documentation,
section `Extended Pascal' for more about EP Modules.)

Another file may contain:

    Module Foo Implementation;

    ...

This will read `foo.gpm' and `foo.gpi' and produce `foo.o'.

To use it in a program, do

    Program Humpta;

    Imports
       Bar;

    ...

It's no problem to find `bar.gpi' from `Program Humpta'.  However `Module Foo
Implementation' does not explicitly import `Bar', so it does not know where to
find those `(some, identifiers, listed, here)'.  To locate them, it looks at
the name of the module, `Foo', looks up `foo.gpm' where `bar' is listed.  Now
it can find `bar.gpi' - voila!

If it looks weird for you, never mind, it does so for me as well.  You don't
need to worry about all this unless you want to change from UCSD-style Units
to EP-style Modules. ;-)

Schoene Gruesse,

    Peter

  Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
 maintainer GNU Pascal [970510] - http://home.pages.de/~gnu-pascal/ [970125]


Peter Gerwinski (peter@agnes.dida.physik.uni-essen.de)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es