Q: How do you use UNITs in TurboGPC? Plus general comments ....

Peter Gerwinski pege at rs1.Theo-Phys.Uni-Essen.DE
Mon Mar 18 14:13:02 CET 1996


Hello, Arcadio, hello, GPC-list!

> I just downloaded the precompiled ELF binary version of "Turbo" GPC for 
> Linux.  I've been playing around with it for the past few minutes, but I 
> can't seem to be able to figure out how to make and use Borland Pascal UNITs.

If you are speaking of the binaries on kampi.hut.fi or ftp.uni-augsburg.de:
those are a.out binaries, no elf binaries. If you really have found elf
binaries, please tell the gpc-list where you got them from!

> To try it out, I made a simple program (test1.p) that called the 
> procedure "Intro" which was in another unit (unit1.p).  I first compiled 
> the unit (thinking that gpc doesn't have a built-in make like BPC/TPC 
> does) 

That's correct. :-(

> with the following command line: "gpc -c unit1.p".  I then 
> proceeded to compile and link test1.p -- but as I expected it didn't 
> work.  I get the message:
> "No exported interface matching 'Unit1''
> "undeclared indentifier 'Intro' .....'

Unfortunately, that's correct, too. In the moment, Extended Pascal modules
and Turbo Pascal units are not yet fully implemented. It is necessary to
have at least the Interface module in the same source file as the calling
program (or module). I have some ideas how to fix it, but this will take
some time. Up to that day, I am using the following (ugly) construction:
Assume a unit (or module) being in "mymodule.pas" and the program being in
"myprogram.pas". Then I include "mymodule.pas" into "myprogram.pas" using
the preprocessor:

    (*I MyModule *)                     #include "mymodule.pas"

    Program MyProgram;                  Program MyProgram;
                                   or
    uses                                uses
      MyModule;                            MyModule;

    ...                                 ...

As long as this is necessary, Extended Pascal modules have the advantage
that the interface and implementation part are in two separated source
files and it is sufficient to include the interface module, while Turbo
Pascal units have to be recompiled each time the program is compiled,
which is of course not the purpose of the unit concept. But since I am
very incontent with this situation, there is hope that I will change it
not too far away in the future.

> How goes the work on "Turbo" GPC?

In the moment, I am working on my Ph. D. thesis, so I don't have much
time for working on GPC. But I promise that I will continue this work
even more intensively, once I am Ph. D. (Doctor) which will be the case
somewhere in the second half of 1996.

> ... He also said that he was 
> gonna put the new Object Pascal standard up for ftping as well ... so 
> perhaps Object Pascal can be incorporated into GPC ... shouldn't be too 
> hard now ... with "Borland Pascal with Objects" already in place.

Perhaps I will have a look at it. I am going to re-implement objects
in complete to make them work better with the debugger and to make them
compatible to C++ classes (which is *not* the case in the moment) inclu-
ding multi-inheritance, which -- as far as I know -- has never been seen 
in Pascal up to now. And I think about implementing more features of the
Pascal-SC standard which would make GPC *very* useful for scientific
applications.

But there is yet another branch of the GNU Pascal project I am working
on: Did you look at my BO5 library? It should be in the same directory 
as the turbo-alpha stuff and includes a nice README.BO5 file. (Another
nice place for it would be the contrib directory.) Try it! :-)

Greetings,

    Peter

--------------------------------------------------------------------------------
Dipl. Phys. Peter Gerwinski
Fachbereich Physik
Universitaet-GH Essen                   Phone:  +49-201-183-2763
D-45117 Essen                           Fax:    +49-201-183-2120
Germany                                 e-mail: pege at mail.theo-phys.uni-essen.de
--------------------------------------------------------------------------------




More information about the Gpc mailing list