How do I access f77 common variables from C ?

Chuck Karish karish at denali.stanford.edu
Wed Jul 20 23:52:25 AEST 1988


In article <1324 at maccs.McMaster.CA> peter at maccs.UUCP (peter) writes:
>How does one access common variables (in blank or named common block) from
>a C function linked to an f77 program ?

	I've done this (pcc, f77) by declaring an external structure
	in the C program with the same name as the common block.
	The obvious pitfall in this is that you assume that the
	alignment and data representation in the structure are
	the same as in the common block.  If there is a difference,
	it may be necessary to insert dummy variables into one or
	the other to make things fit.

	For blank common, individual external variables should work;
	I haven't tried this, though.

Chuck Karish	ARPA:	karish at denali.stanford.edu
		BITNET:	karish%denali at forsythe.stanford.edu
		UUCP:	{decvax,hplabs!hpda}!mindcrf!karish
		USPS:	1825 California St. #5   Mountain View, CA 94041



More information about the Comp.lang.c mailing list