Re: function point of class function
On Mar 5, 3:16 pm, Ralf Goertz
<r_goe...@expires-2006-11-30.arcornews.de> wrote:
[...]
Just don't forget to declare the wrapper `extern "C"'. For
the day when you compile with a compiler which isn't broken.
(Both VC++ and g++ are broken in this regard. Sun CC issues
an error message, however.)
Oh thanks, as you say, g++ didn't bark at me. But I thought
that a function that is explicitely declared as a C function
can't call a C++-function.
You're still compiling in C++. A function declared `extern "C"'
is a C++ function, and can be (and in fact must be, if its
definition is in a C++ source file) written in C++, using all of
the facilities of C++. The only difference is the way the
compiler generates its interface: if the function is `extern
"C"', the compiler generates the interface (function name,
calling conventions, etc.) as if it were a C function. (On most
platforms today, C and C++ use the same calling conventions, but
there's no real reason that this should be the case, and I've
used a compiler on Intel where they didn't.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34