I am trying to use a callback function. This has worked fine when the caller and the called function were in the same file. I have lately decided to make the called function part of a library, so I have it declared in a header file, defined in its own file. I #include the new header in the calling source file, linking to the new library, and now I get an “Undefined reference” error to the callback function.
Is there something special I have to do to make this work? I notice when I use the same thing in pthread libraries for example, the callback function is defined as a pointer function.
Edit: I am linking to the library, and I can call other functions in the library just fine.
Turns out the problem was my header had the definition in there twice, one with static, one without.