[comp.os.msdos.programmer] Shrinking my program to run another

ejost@unix.cis.pitt.edu (Ernest J. Obusek) (06/20/91)

A program I am working on has grown quite large.  The language I am using
doesn't support overlays.  My program is split into 5 parts.  The main part
runs the others as needed.  However, I'm still running out of room.  I'd
like to be able to have the main part remove itself from memory as much as
possible while running one of the other parts.  How is this done?

I basically want a way to swap parts of my program to disk at run-time.

I am a very experienced PC programmer so don't be afraid to be technical. 

Thank you!!

Ernest

P.S.  Thanks to those who sent me info about PC serial ports.  I solved the
problem before getting a chance to read any of the responses.  I ended up
directly programming the PC's UART to the baud rate I wanted and it worked
wonderfully well!

drezac@dcsc.dla.mil (Duane L. Rezac) (06/20/91)

From article <141957@unix.cis.pitt.edu>, by ejost@unix.cis.pitt.edu (Ernest J. Obusek):
> A program I am working on has grown quite large.  The language I am using
> doesn't support overlays.  My program is split into 5 parts.  The main part
> runs the others as needed.  However, I'm still running out of room.  I'd
> like to be able to have the main part remove itself from memory as much as
> possible while running one of the other parts.  How is this done?
> 
> I basically want a way to swap parts of my program to disk at run-time.
> 
> I am a very experienced PC programmer so don't be afraid to be technical. 
> 
> Thank you!!
> 
> Ernest


If you don't mind linking in another library instead of using your
own routines, try spawn030.zip from simtel20 - it is a swapping spawn
that will swap to ems or disk.



Duane L. Rezac
--
Verse of the Hour:
"But I say unto you, That every idle word that men shall speak , they shall
give account therof in the day of judgment. 
    Matt. 12:36
-- 
+-----------------------+---------------------------------------------------+
| Duane L. Rezac |These views are my own, and NOT representitive of my place|
| dsacg1!dcscg1!drezac    drezac@dcscg1.dcsc.dla.mil      of Employment.    |
+-----------------------+---------------------------------------------------+

pshuang@athena.mit.edu (Ping-Shun Huang) (06/21/91)

In article <141957@unix.cis.pitt.edu> ejost@unix.cis.pitt.edu (Ernest J. Obusek) writes:

 > A program I am working on has grown quite large.  The language I am
 > using doesn't support overlays.

Solution: switch languages.  OK, OK, that's not a viable solution....

 > I'd like to be able to have the main part remove itself from memory as
 > much as possible while running one of the other parts.

If you've written your main program module in such a way that it doesn't
need to retain the value of any memory variables through a call to one
of the other four parts, you could stuff keystrokes into the buffer;
this is *NOT* an elegant solution, but it would work.

For commercial library solutions, the Programmer's Shop lists under
General_Libraries:Operating_System_Enhancements:

	EXEC, by Blaise Computing
	Overlay, by Gambit Software
	Hold Everything, by South Mountain Software

These products are designed to swap out your application (to hard disk
or expanded/extended memory) so that the user can shell out to DOS with
lots of memory to run another application.  They might let you shell out
to some other program than COMMAND.COM.  From the product descriptions
it would appear that they support multiple languages, which means you
should be able to call them from just about any language with some
modicum of low-level access.

An amusing solution, if there are any commercial libraries to turn your
application into a TSR and swap it out to disk when not in use (and
there are if you're writing in Foxbase, Clipper, dBASE, C, Pascal,
assembler, etc.) would be to turn the main module into a TSR which is
always popped up unless one of the other four modules are in use.

--
Above text where applicable is (c) Copyleft 1991, all rights deserved by:
UNIX:/etc/ping instantiated (Ping Huang) [INTERNET: pshuang@athena.mit.edu]

ralf+@cs.cmu.edu (Ralf Brown) (06/22/91)

In article <1131@dcsc.dla.mil> drezac@dcsc.dla.mil (Duane L. Rezac) writes:
}If you don't mind linking in another library instead of using your
}own routines, try spawn030.zip from simtel20 - it is a swapping spawn
}that will swap to ems or disk.

A correction, for those trying to use a mail server....   That's
spawno30.zip (oh-three-zero, not zero-three-zero) in PD1:<MSDOS.C>.
It also swaps to XMS.

-- 
{backbone}!cs.cmu.edu!ralf  ARPA: RALF@CS.CMU.EDU   FIDO: Ralf Brown 1:129/53
BITnet: RALF%CS.CMU.EDU@CARNEGIE   AT&Tnet: (412)268-3053 (school)   FAX: ask
DISCLAIMER?  Did  | It isn't what we don't know that gives us trouble, it's
I claim something?| what we know that ain't so.  --Will Rogers