>> If you want to pass a pointer to a variable to somewhere else, it doesn't
>> have to be extern; it can be made static.
>
>Mnay of the network pointers are passed from other files in the network
>code.
\begin{C-Legalese}
If you pass the address of object to another compilation unit
(i.e. source file), this object does not need to be extern; it
can be static or allocated (but NOT automatic).
\end{C-legalese}
We're probably not discussing the same subject, or else I'm not getting
through.
Let's take another example, which is also perfectly valid C:
hello.h:
char *hello_fcn(void);
hello.c:
#include "hello.h"
static char msg[]="Hello, world!\n";
char *hello_fcn(void)
{
return msg;
}
main.c:
#include <stdio.h>
#include "hello.h"
int main()
{
char *mymsg;
msg = hello_fcn();
printf("%s",mymsg);
return 0;
}
In this example, msg does not have to be extern; static is fine.
-- Thomas Koenig, Thomas.Koenig@ciw.uni-karlsruhe.de, ig25@dkauni2.bitnet. The joy of engineering is to find a straight line on a double logarithmic diagram.