[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: regarding external and internal linking



Quotes from "C++ Programming Language" of Bjarne Stroustrup:
"A name that can be used in translation units different from the one in
which it was defined is said to have external linkage... A name that can be
referred to only in the translation unit in which it is defined is said to
have internal linkage"

To make it clearer, look at those 2 files:

file1.c
int i=1;
....

file2.c
extern int i
int j
.....

i is external because it is defined in file1.c but can also be used in
file2.c whereas j is just internal to file2.c.
In this example it seems straight forward, but often the difference is
subtle and you can get confused pretty easily.

I hope this answers your question.
Ouriel
----- Original Message -----
From: "kamesh jayachandran" <kameshj@xxxxxxxxxxxxxxx>
To: <linux-india-programmers@xxxxxxxxxxxxxxxxxxxxx>
Sent: Sunday, August 27, 2000 12:42 PM
Subject: [LIP] regarding external and internal linking


> I want to get clarified the difference between and internal and external
> linking in c programmes.
> Thanks in advance
> kamesh jayachandran
>
>
> ---------------------------------------------
> Find out more about this and other Linux India
> mailing lists at http://lists.linux-india.org/