[comp.lang.pascal] Chaining TP programs

Dex@cup.portal.com (Paul Dex Durden) (01/04/89)

Hi,
  I was wonderng if there is any way to load and run a TP program from within
another TP program.  What I'm looking for is a command similar to the CHAIN 
or LOAD"Prgname",R commands of basic.
  Any help will be appreciated.

Thanks in advance,
  Paul "Dex" Durden          Dex@cup.portal.com

mlw@pyr.gatech.EDU (Michael Williams) (01/05/89)

   In Turbo Pascal 3.0 it is possible for one TP program to execute another
using the "execute" command.  It worked like this:

   assign(fp, 'myorog.com');  { var fp : file }
   execute(fp);

   However, this only worked for TP .com files.  In TP4.0/5.0, the "exec"
command is much more useful.  You simply do "exec(path, commandline)".
The command line is optional, and non-turbo programs can be called.

Michael Williams

dmurdoch@watdcsu.waterloo.edu (D.J. Murdoch - Statistics) (01/05/89)

In article <7003@pyr.gatech.EDU> mlw@pyr.UUCP (Michael Williams) writes:
>   In TP4.0/5.0, the "exec"
>command is much more useful.  You simply do "exec(path, commandline)".
>The command line is optional, and non-turbo programs can be called.

Remember to limit the size of your heap before you use "exec".  Without a
$M directive or a change to the high heap limit memory size compile option,
there won't be enough memory for the program to run.  The default is for 
a Turbo program to assign all free memory to the heap.

I believe I've read that Turbopower's Turbo Professional library contains
routines to dynamically free up memory for exec to use, but I don't know 
the details.

Duncan Murdoch