🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4551

static and extern, and a variable be both ?

#4551
From: Aaron Hicks at Netcom
Date: Wed, 03 Jan 1996 20:12
38 lines
1513 bytes
Folks,
  

   After much looking and little finding I have come to ask for your 
assistance.  I'm working on a project in which we believed the best way
to insure a 500K array was allocated corectly was to declare it as static  
and then when we needed to use it in a nother program to declare it there as 
an extern.  When we did this we got a variable undefined error during the
linking of the programs.  Now my question is this a standard C compiler 
thing or is this compiler wrong.  Below are the relative parts of the code:

common.h
...
typedef char Bit_Fail_Array_Type[Row_Max][Column_Max_By_Byte][Sub_Array_Max];
...

raster.c 
...
static Bit_Fail_Array_Type bit_fail_array_table;
... 

raster_anaylsis.c
...
extern Bit_Fail_Array_Type bit_fail_array_table;
...


I have found that this will work if I just do not declare the array as 
a static in the first place.  It then will work fine, but we a slightly 
afraid that if we do not declare this as static when it is declared there
may not be enough memory left after the other parts of this program have 
ran of a while.


Thanks in Advance

Aaron Hicks
ahicks@netcom.com
Technical Details
Message-ID: <ahicksDKMG56.K20@netcom.com>
Path: arc1-ca.pugleaf.net!netcom.com!ahicks

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!netcom.com!ahicks
From: ahicks@netcom.com (Aaron Hicks at Netcom)
Subject: static and extern, and a variable be both ?
Message-ID: <ahicksDKMG56.K20@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
Date: Wed, 3 Jan 1996 20:12:42 GMT
Sender: ahicks@netcom3.netcom.com