Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!mips!bridge2!jarthur!uunet!lll-winken!llnl.gov!bertsche From: bertsche@llnl.gov (Kirk Bertsche) Newsgroups: comp.lang.c Subject: Declaring externally-defined structures Message-ID: <98256@lll-winken.LLNL.GOV> Date: 29 May 91 23:35:28 GMT Sender: usenet@lll-winken.LLNL.GOV Distribution: na Organization: Lawrence Livermore National Laboratory Lines: 53 Nntp-Posting-Host: 128.115.77.225 I am new to C programming, and am having some difficulty trying to declare a variable in a function, which is part of a structure defined in my top-level routine. I have a main program with about 6 functions, which is to be patched into an existing software system. My top-level routine (containing a function and my main program) has, near the top: struct lb_link tuneflag, tuneerror; In the main program I have; if (!rsv_1name("STUNE.FLG", LB_INPUT, &tuneflag)) high_water(98); if (!rsv_1name("STUNE.ERR", LB_INPUT, &tuneerror)) high_water(98); (This uses a bunch of routines defined by the existing software to resolve names and assign addresses and structures.) When I want to read the state of these variables, I do something like: while (*tuneflag.pval) { This all seems to work fine in my top-level routine. The problem I'm having is when I want to check this flag in another function. I've tried all of the following near the beginning of the second function (on line 22, to be precise): extern struct lb_link tuneflag,tuneerror; struct lb_link tuneflag,tuneerror; extern struct tuneflag,tuneerror; extern float *tuneflag.pval,*tuneerror.pval; But none of these seem to work. When I try to check the flag, by looking at *tuneflag.pval (on line 40), I get compiler error messages: line 40: pval undefined line 40: member of structure or union required line 40: incorrect indirection For some of the attempts above, I also get errors like: line 22: unknown size line 22: unknown size Any ideas? How can I tell this function that the variable in question is defined elsewhere? Please respond by e-mail, (bertsche@llnl.gov), if anyone has any ideas. Thanks! ----------------------------------------------------------------------------- Kirk Bertsche (bertsche@llnl.gov) (415) 422-8139 Lawrence Livermore National Laboratory P.O. Box 808 L-397, Livermore, CA 94551-0808