Mail Archives: djgpp/1997/06/11/07:35:42
Michael Goffioul wrote:
>
> I'd like to know if it's possible for a called program (with "exec"
> command) to access the same global variable as the calling program,
> a sort of shared variable between 2 programs.
>
> For example, if a static variable "a" is declared in a header file
> included in 2 differents programs "prog1.exe" and "prog2.exe". If
> "prog1.exe" calls "prog2.exe", is it possible that prog2 uses the same
> global variable than prog1 ?
Adding to what Eli said, I'll also mention that you can allocate a
buffer in conventional memory to store your data, and pass the address
of that buffer to the child program. This is also nonportable, but less
so than fiddling with global selectors. ;)
I don't recall the exact names of the functions to use offhand, but they
are in the libc documentation.
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com |
| Proud owner of what might one | http://www.cs.com/fighteer |
| day be a spectacular MUD... | Plan: To make Bill Gates suffer |
---------------------------------------------------------------------
- Raw text -