Re: extern "C"
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Thu, 7 Feb 2008 09:38:00 -0600
Tim Roberts wrote:
George <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Just to confirm what is the most correct way beyond a just working
function.
1.
We need to add extern "C" to both variable/function
definition/declaration? Or only need to add to the variable/function
declaration?
2.
How about extern? Declaration only or both declaration and
definition are required?
BTW: previously, I only add to declaration, but after reading more
and more code which add to both declaration and definition, I come
to here to ask this question.
extern "C" is only required for the declaration.
Do you understand that extern "C" is only used for C++ that you need
to call from a C function?
extern "C" should also be used with dllexport, even if the caller is C++, to
get rid of the (compiler version dependent) name mangling.
.
- Follow-Ups:
- Re: extern "C"
- From: Andre Kaufmann
- Re: extern "C"
- References:
- Re: extern "C"
- From: Tim Roberts
- Re: extern "C"
- Prev by Date: Re: COM CreateInstance method
- Next by Date: Re: CreateInstance
- Previous by thread: Re: extern "C"
- Next by thread: Re: extern "C"
- Index(es):
Relevant Pages
|