From: BKNATZ@cc.brynmawr.edu
Newsgroups: comp.lang.pascal
Subject: Units Using Units
Date: 4 Apr 92 18:19:41 GMT

(********************************
      
      Thanks for the comments, but either I'm confused, or our
      beliefs are wrong (or both!)

      I still don't understand why the compiler needs UNITDEEP.TPU?

      To compile MyProgram, I seem to need UnitDeep no matter
      where the "Uses UnitDeep" statement is put in UnitShallow. 
      (I'm using DRDOS 6.0, but my collaborator has confirmed
      this using MSDOS 5.0)

      Here's the scoop. ********************************)

Volume in drive C is JS NOTEBOOK
Directory of  C:\SL\TEST

.            <DIR>     4-04-92 10:06a
..           <DIR>     4-04-92 10:06a
UNITDEEP PAS       48  4-04-92 10:22a
UNITSHAL TPU      416  4-04-92 10:14a
UNITSHAL PAS       67  4-04-92 10:10a
NOPROB              0  4-04-92 10:23a
UNITDEEP TPU      400  4-04-92 10:22a
MYPROGRA PAS       31  4-04-92  9:58a
HIDE         <DIR>     4-04-92 10:09a
       10 File(s)   8896512 bytes free

C:\SL\TEST>type *.pas

UNITDEEP.PAS:
unit UnitDeep;
interface
implementation
end.

UNITSHAL.PAS:
unit UnitShallow;
interface
implementation
uses unitDeep;
end.

MYPROGRA.PAS:
Uses UnitShallow;
begin
end.

C:\SL\TEST>tpc myprogram
Turbo Pascal Version 5.5  Copyright (c) 1983,89 Borland International
MYPROGRAM.PAS(3)
3 lines, 0.7 seconds, 1200 bytes code, 646 bytes data.



 Volume in drive C is JS NOTEBOOK
 Directory of  C:\SL\TEST

.            <DIR>     4-04-92 10:06a
..           <DIR>     4-04-92 10:06a
UNITDEEP PAS       48  4-04-92 10:22a
UNITSHAL TPU      416  4-04-92 10:14a
UNITSHAL PAS       67  4-04-92 10:10a
NOPROB   TXT      843  4-04-92 10:30a
UNITDEEP TPU      400  4-04-92 10:22a
MYPROGRA PAS       31  4-04-92  9:58a
MYPROGRA EXE     1312  4-04-92 10:26a
HIDE         <DIR>     4-04-92 10:09a

(********************************
      OK, no problem.  But now....
          ********************************)

C:\SL\TEST>del unitdeep.*

C:\SL\TEST>tpc myprogram
Turbo Pascal Version 5.5  Copyright (c) 1983,89 Borland International
MYPROGRAM.PAS(1): Error 15: File not found (UNITDEEP.TPU).
Uses UnitShallow;
                ^
(********************************
      Well, maybe I need to revise UnitShallow....
          ********************************)


C:\SL\TEST>type unitsh*.pas

UNITSHAL.PAS:
unit UnitShallow;
interface
uses unitDeep; {USES STATEMENT MOVED INTO INTERFACE}
implementation
end.

(********************************
      restore UnitDeep in directory, and recompile UnitShallow
          ********************************)

C:\SL\TEST>tpc unitshallow
Turbo Pascal Version 5.5  Copyright (c) 1983,89 Borland International
UNITSHALLOW.PAS(5)
5 lines, 0.3 seconds, 0 bytes code, 0 bytes data.

C:\SL\TEST>tpc myprogram
Turbo Pascal Version 5.5  Copyright (c) 1983,89 Borland International
MYPROGRAM.PAS(3)
3 lines, 0.5 seconds, 1216 bytes code, 646 bytes data.

(********************************
    Again, no problem with UnitDeep present, but...
          ********************************)


C:\SL\TEST>del unitdeep*.*

C:\SL\TEST>tpc myprogram
Turbo Pascal Version 5.5  Copyright (c) 1983,89 Borland International
MYPROGRAM.PAS(1): Error 15: File not found (UNITDEEP.TPU).
Uses UnitShallow;
                ^
(********************************
    So what's going on?  Why does the compiler need UNITDEEP.TPU?
          ********************************)