473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

What is extern "C" ?

Hello

I have seen in many source files the usage of extern +ACI-C+ACI-.
What is its purpose?

Thanks

VRZ

Nov 13 '05 #1
5 49730
"Vijay Kumar Zanvar" <vi*****@hotpop.com> writes:
I have seen in many source files the usage of extern "C".
What is its purpose?


That's a C++ construct, so you should ask about it in
comp.lang.c++, after checking their FAQ.
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Nov 13 '05 #2
Vijay Kumar Zanvar wrote:
Hello

I have seen in many source files the usage
What is its purpose?

Should not appear in C code. Declares a symbol in C++ to have C compatible
linkage.

--
Tim Prince
Nov 13 '05 #3

"Ben Pfaff" <bl*@cs.stanford.edu> wrote in message
news:87************@pfaff.stanford.edu...

(snip)
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan


It seems that according to Brooks' law it is the same.

Brooks law goes something like: "Writing the code takes the first 90% of the
time, and debugging takes the second 90%."

(See the book "Mythical Man Month")

-- glen
Nov 13 '05 #4
In article <bi************@ID-203837.news.uni-berlin.de>,
"Vijay Kumar Zanvar" <vi*****@hotpop.com> wrote:
Hello

I have seen in many source files the usage of extern "C".
What is its purpose?


It is part of the C++ language. It tells a C++ compiler that a function
is written in C. Don't use this in C programs, your C compiler will just
barf on you.
Nov 13 '05 #5
On Wed, 27 Aug 2003 09:22:53 +0100, Christian Bau
<ch***********@cbau.freeserve.co.uk> wrote in comp.lang.c:
In article <bi************@ID-203837.news.uni-berlin.de>,
"Vijay Kumar Zanvar" <vi*****@hotpop.com> wrote:
Hello

I have seen in many source files the usage of extern "C".
What is its purpose?


It is part of the C++ language. It tells a C++ compiler that a function
is written in C. Don't use this in C programs, your C compiler will just
barf on you.


While C++ is off-topic here, your answer is incorrect. It tells a C++
compiler that a function has C linkage, not that it is written in C.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Shea Martin | last post by:
I am trying to use a system call which takes a function ptr. My compiler won't compile the code if I give the system_call a ptr to a class member function, A::func(). To combat this, I created an...
4
by: Sergei | last post by:
I ran into this problem. I needed to create an entry for access to a library of functions that are "extern C", and I just can't find the right syntax, if it exists at all ( I am using MSVC...
111
by: JKop | last post by:
Okay here we go, I feel it's about time people conversed about the bullshit aspects of C++ (including the bullshit stuff brought forward from C). I'll begin with a few of my own grievances: 1)...
3
by: Andy | last post by:
Hi, This is just a simple hello world program. #include <iostream> using namespace std; int main() { cout<<"Hello,world\n"; }
8
by: Generic Usenet Account | last post by:
Our C++ program was linked with some legacy C functions. We had used the extern "C" declaration, and everything was working fine. Then someone thought that it would be better to have a consistent...
1
by: Phlip | last post by:
Language Lawyers: Compare this: extern "C" int Maine() { ... bool runTests(); return !runTests(); }
11
by: Daniele Benegiamo | last post by:
Is the following program standard-compliant? I've compiled it with some compilers and no errors or warnings are produced, but this is not a demonstration. The "incriminated" part is the...
12
by: G Patel | last post by:
I've seen some code with extern modifiers in front of variables declared inside blocks. Are these purely definitions (no definition) or are they definitions with static duration but external...
19
by: ccwork | last post by:
Hi all, I am reading "C: A Reference Manual" 4th ed and I get lost for the "extern". It says that global object without specifying the storage-class specifier will have "extern" as the default...
4
by: kk_oop | last post by:
Hi. I need to write a C++ callback function and register it with a C program. I've read that this can be done if the callback function is a static method. I've also read that I should use a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.