|
-
July 17th, 2008, 01:59 AM
#1
Use of extern "C" with global variables
Hi,
Over the years had thought that extern "C" was used to prevent C++ compilers from mangling function names - to allow calls from C code to C++ code. Name mangling was introduced in C++ compilers for the purpose of support for function over-riding.
However, I have come across code where extern "C" has been used to declare global variables in a file. I thought global variables had nothing to do with name mangling - besides I am used to seeing only the extern keyword to declare global variables.
Can you please let me understand the reason why extern "C" would need to be used with global data variables too ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|