Mail Archives: djgpp/1996/11/06/17:15:15
From: | Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Question
|
Date: | Wed, 6 Nov 1996 09:08:05 +0200
|
Organization: | NetVision LTD.
|
Lines: | 27
|
Message-ID: | <Pine.SUN.3.91.961106085836.304M-100000@is>
|
References: | <327FF0BE DOT 27B8 AT fab DOT net>
|
NNTP-Posting-Host: | is.elta.co.il
|
Mime-Version: | 1.0
|
In-Reply-To: | <327FF0BE.27B8@fab.net>
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
On Tue, 5 Nov 1996, Eric Christopherson wrote:
> There is a program, called A.
> Program A has a variable V.
> Program A shells out and runs Program B, passing a pointer to V (in
> hex).
> Is it at all possible for B to read V (if A and B are compiled with
> DJGPP)?
DJGPP does this trick all the time to pass long command line to child
DJGPP programs.
Here's the deal: allocate a buffer in low (below 1MByte mark) memory by
calling the `__dpmi_allocate_dos_memory' library function. Move whatever
info you want the child program to access to that buffer (with `dosmemput'
or `movedata' functions). Then pass the real-mode address (segment and
offset) of this buffer to the child on the command line that invokes the
child. The child should use `dosmemget' or `movedata' to access that
buffer.
If the buffer you want to pass is longer than 64KB, this is a bit more
complicated, but still doable.
If you are sure you will always run under DPMI 0.9, you can do the same
with protected-mode memory (where you don't have the 64KB limits), but I
don't recommend it, since you will risk surprises with some DPMI hosts.
- Raw text -