Friday, 22 June 2012

What does extern "C" int func(int *, Foo) accomplish?

Assuming this is a declaration of function written in C++ code:
It will turn off "name mangling" for this function so that one can link to code compiled by C compiler. (this C++ function can be used in C code)

Assuming func is a function written in C, this is how it should be declared (prototyped) in C++ code so C++ code can invoke this C function.

No comments:

Post a Comment