8

Possible Duplicate:
In C++ source, what is the effect of extern “C”?

I am asking this because I'm writing a C++ program which uses a C library. This library has foreach functions that take a callback (naturally). Obviously, the library would call my callbacks as C functions.

First of all, does this have anything to do with linkage of C vs C++?

If it does, is something like this valid and correct?

extern "C" static bool callback(/*parameters*/)
{
    cout << "C++ thing inside the function" << endl;
    /* etc */
}
Community
  • 1
  • 1
Shahbaz
  • 46,337
  • 19
  • 116
  • 182

0 Answers0