COHERENT manpages
This page displays the COHERENT manpage for extern [Declare storage class].
List of available manpages
Index
extern -- C Keyword Declare storage class extern indicates that a C element belongs to the external storage class. Both variables and functions may be declared to be extern. Use of this keyword tells the C compiler that the variable or function is defined outside of the present file of source code. All functions and variables defined outside of functions are implicitly extern unless declared static. When a source file references data that are defined in another file, it must declare the data to be extern, or the linker will return an error message of the form: undefined symbol name For example, the following declares the array tzname: extern char tzname[2][32]; When a function calls a function that is defined in another source file or in a library, it should declare the function to be extern. In the absence of a declaration, extern functions are assumed to return ints, which may cause serious problems if the function actually returns a 32-bit pointer (such as on the 68000 or i8086 LARGE model), a long, or a double. For example, the function malloc appears in a library and returns a pointer; therefore, it should be declared as follows: extern char *malloc(); If you do not do so, the compiler assumes that malloc returns an int, and generate the error message integer pointer pun when you attempt to use malloc in your program. See Also auto, C keywords, pun, register, static, storage class ANSI Standard, §6.5.1