cychao@csun12.cs.uh.edu (Chih-Yu Chao (Dr. S. Huang)) (03/15/91)
If I EXEC a program, say B, in a main program A, how can I access all of the variables ( including global variables ) which is defined in A from spawned program B ? ------------------------------------ CY Chao U. of Houston, Texas
CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) (03/16/91)
In article <1991Mar14.194027.20961@menudo.uh.edu>, cychao@csun12.cs.uh.edu ("Chih-Yu Chao (Dr. S. Huang") wrote: > If I EXEC a program, say B, in a main program A, how can I access > all of the variables ( including global variables ) which is > defined in A from spawned program B ? Are you using Turbo Pascal? I cannot answer for other implementations of Pascal, but in Turbo, you can pass (string representations of) pointers as parameters to the execed program using the CmdLine parameter of Exec. Those pointers can be to anything in memory, including variables on the stack. Use the Ofs and Seg functions to get the values for the pointers. It is probably best to consolidate the shared variables into a contiguous block of memory by declaring them consecutively, then include the declarations in the source for both programs. Also be sure that the $A switch is the same in each program. +--------------------------------------------------------------------+ | Karl Brendel Centers for Disease Control | | Internet: CDCKAB@EMUVM1.BITNET Epidemiology Program Office | | Bitnet: CDCKAB@EMUVM1 Atlanta, GA, USA | | Home of Epi Info 5.0 | +--------------------------------------------------------------------+