[comp.sys.ibm.pc] Making overlays for BASIC or C

rbh@stcvax.UUCP (Brent Haws) (01/19/88)

Is anyone there out there that has knowledge of how to make
an overlay file for an EXE file.  I have one that is getting large.
OR is this even the way to go???  Any help would be helpful or
pointers in the right direction.

thanks
Brent
-- 
Brent Haws   {hao ihnp4 decvax ucbvax!nbires}!stcvax!rbh   (303) 666-4297
StorageTek Corporation, MD-3T, Louisville, CO 80028

rab@mimsy.UUCP (Bob Bruce) (01/21/88)

In article <305@stcvax.UUCP> rbh@stcvax.UUCP (Brent Haws) writes:
>Is anyone there out there that has knowledge of how to make
>an overlay file for an EXE file.  I have one that is getting large.
>OR is this even the way to go???

I have used overlays in the past, and they are NOT the way to go
in most cases.  Use the `exec' system call, and let the operating
system do the dirty work.

If you are using `C' then exec() is usually available as a library
routine.  You should also check out spawn(), if your library provides
it.

If you are using BASIC then you will probably need to write
a small assembly stub to make the exec call.  This is a little
tricky since the exec system call destroys the stack pointer.
You should save SS and SP in your code segment before invoking
the interrupt.

>Brent Haws   {hao ihnp4 decvax ucbvax!nbires}!stcvax!rbh   (303) 666-4297
>StorageTek Corporation, MD-3T, Louisville, CO 80028

 Bob Bruce
 rab@mimsy.umd.edu
 uunet!mimsy!rab

johnl@ima.ISC.COM (John R. Levine) (01/22/88)

In article <10265@mimsy.UUCP> rab@mimsy.UUCP (Bob Bruce) writes:
>In article <305@stcvax.UUCP> rbh@stcvax.UUCP (Brent Haws) writes:
>>Is anyone there out there that has knowledge of how to make
>>an overlay file for an EXE file.  I have one that is getting large.
>
>I have used overlays in the past, and they are NOT the way to go
>in most cases.  Use the `exec' system call, and let the operating
>system do the dirty work.

exec() is OK if the various parts of your program don't need to communicate
much, and if it's acceptable to put each overlay in a separate file. If you
really have one program that just doesn't fit, then overlays are a perfectly
reasonable approach. The latest version of MS C finally gives some hints about
how to use their overlayer, e.g.:

Z> cl a.c (b.c c.c) d.c

will overlay the code for b and c in the same area. Haven't used it, so don't
know how well it works. There are also overlay linkers you can buy.  I have
used Phoenix' PLINK and it works pretty well, once you get used to its
various funkinesses.  In both cases, you can overlay object code from any
language that generates normal .obj files and uses far call instructions to
link from one routine to another.
-- 
John R. Levine, IECC, PO Box 349, Cambridge MA 02238-0349, +1 617 492 3869
{ ihnp4 | decvax | cbosgd | harvard | yale }!ima!johnl, Levine@YALE.something
Gary Hart for President -- Let's win one for the zipper.