I had a C dynamic library, due to some requirement change I have to do some refactoring.
I had following code in one c file.
__attribute__((noinline))
static void *find_document(...)
{
...
}
bool docuemnt_found(const char *name) {
...
find_document(...);
...
}
I separated the docuemnt_found() function in different cpp file. Now docuemnt_found() function cannot link to find_document() method?
I tried creating header for the c file and then include header using extern "C" but it did not work.
I want to keep find_document() inline. Is there anything missing here or something wrong?
The problem here is the declaration of the function as
static– in C, this says that it should be available to other functions within the same compilation unit (.c file), but not to other functions outside the file. Removingstaticshould solve the problem.Incidentally, the second function is misspelled – it should be
document_found, notdocuemnt_found.