Reputation: 4287
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?
Upvotes: 3
Views: 202
Reputation: 13738
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. Removing static
should solve the problem.
Incidentally, the second function is misspelled - it should be document_found
, not docuemnt_found
.
Upvotes: 6