The same applies to function declarations.
You can allow global declarations to be visible to functions in other files. This is how declarations in libraries are created. The specifier static is omitted to make a variable externally visible. If it is written in front, the variable or function is only visible within the file where it is declared.
Inside the file where the external item is to be used, an extern specifier is used to tell the compiler to look outside the current file for a variable. This is often provided in a #include file for a library.
Functions are specified as being located elsewhere by using a function prototype.
Building libraries is found in another note.
Back to Contents page.