Thursday, March 22, 2018

Is extern "C" on a c++ function allowed?








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 */
}

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...