From -4023948906532384930
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ea96cc047f6a22cc
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-08-11 05:15:01 PST
Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!212.74.64.35!colt.net!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: Francis Glassborow <francis.glassborow@ntlworld.com>
Newsgroups: comp.std.c++
Subject: Re: extern "C" -- what is the intent?
Date: Sat, 11 Aug 2001 12:13:57 GMT
Organization: Southfield Microcomputer SS
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <v0ceBIAA0Hd7EwKT@ntlworld.com>
References: <090820010209154805%BobbySchmidt@mac.com>
 <remove.haberg-1008011309410001@du132-226.ppp.su-anst.tninet.se>
 <rjRvUrB1oAd7Ew7$@ntlworld.com>
 <remove.haberg-1008012124210001@du136-226.ppp.su-anst.tninet.se>
Reply-To: Francis Glassborow <francisG@robinton.demon.co.uk>
X-Trace: mail2news.demon.co.uk 997532043 mail2news:16016 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
MIME-Version: 1.0
X-Newsreader: Turnpike Integrated Version 5.00 U <TilyaeicE$WmMOP9F8P4$y3lmP>
Lines: 37
Xref: archiver1.google.com comp.std.c++:6939

In article <remove.haberg-1008012124210001@du136-226.ppp.su-
anst.tninet.se>, Hans Aberg <remove.haberg@matematik.su.se> writes
>Well, I don't see in
>  extern "C" A f(B x) {
>    // C++ definition
>  }
>if A and B are not C types, how f could be viewed as a C function from the
>linking point of view. If they are something else, one must still be able
>to convert them to objects that the linker can view as binary C objects
>before handing them over to the linker.
>
>Or so was my impression. If you know how it works, perhaps you should
>describe it.

extern "C" is about C++. 

extern "C" void foo(mytype);

How does it matter what type mytype is? Unlike function, we do not
overload types so as long as mytype has a unique ID, that is the end of
the story. Of course a C program cannot pass arguments to foo unless it
has a compatible type but that is quite different and not the concern of
the linker. The linker only has to find object code from compiling a
function definition for foo. If the argument does not match, it is the
compilers job to call it out.

Francis Glassborow      ACCU
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]



