Common areas/common data/data sharing

Eychaner, Glenn C. gceych at juliet.caltech.edu
Thu Dec 13 12:29:14 AEST 1990


I'm not sure that this is the right place to post this, but...
I want to get the effect of FORTRAN group common blocks in C.  In other words,
I want to be able to have 3 or 4 programs all sharing the same block of data,
some reading from it and some writing to it, without storing it all to a file
(file access is rather slow).  In FORTRAN, I would create a common block and
INSTALL it using the VAX Installer.  when I try to INSTALL a variable list
(linked shared) as a shareable image, it fails with:  cannot create writable
section to read only file.  Any ideas from anyone out there?

An example:
	I want some programs to share some data...say the variables i,j,k.
	So i create a program:
	/* Common block */
	int i,j,k;

	compile it, and link it /SHARED.  In each program I want to use it, I
	declare the variables as extern and link the program with the block.
	This allows the programs to share the variables.

	Now, to get them to share the DATA, I INSTALL it.  This fails as
	described above.

Thanks in advance for any suggestions you might have.

Glenn Eychaner   |Eychaner at SunCub.Caltech.edu|Remember: It is easier to ride a
40386 N Shore Ln |gceych at iago.caltech.edu    |camel through the eye of a needle
Big Bear City, CA|                           |than to drive a Buick through the
            92314|!*** G O   N I N E R S ***!|hole in a doughnut.



More information about the Comp.lang.c mailing list