[comp.sys.ibm.pc] where's my parent?

david@squid.UUCP (04/23/88)

From squid!david Fri Apr 22 05:14 CST 1983 remote from occrsh
From: ihnp4!occrsh!squid!david (Safe from sanity)
Date: Fri, 22 Apr 83 5:14:21 CST
Message-Id: <831110558D@squid.UUCP>
Subject: where's my parent?

/**
 **  Address in header may be incorrect. Please reply to:
 **  { ihnp4 | moss | cbosgd | uokmax }!occrsh!squid!david
 **
 **/

>I have a program which invokes another program via an exec-type call
>("system()" in C).  In mess-dos so far, this means your calling program
>goes away until the new program has done its stuff.  My calling program
>needs to know where the called program got loaded in memory.  Does
>anyone have any hints on how to do this?

You don't say what you're after, so I'm assuming that you want to use data
in the calling program.

Some compilers will allow you to find out what the current data seg is. In
Turbo C, it is the '_DS' global variable. Create a far pointer to your
data like this:

  far_pointer = MK_FP( _DS, &data ) ;

and pass it to the called program in an environment variable. The MK_FP() is
really a macro, which says:

  (void far *)( (arg1 << 16) | arg2 )

If your compiler has spawn(), you might look into using it instead of
system(). It allows you more control over the environment.

David Drexler    {at&t sites}!occrsh!squid!david