I have a static function callback:
static SCDynamicStoreCallBack callback( [params] ){ ... }
In main, I’m calling
createIPAddressListChangeCallbackSCF(callback, manager, &storeRef, &sourceRef);
This function requires a callback function to be passed as a parameter. However when I try and compile, I get the error
error: ‘callback’ was not declared in this scope
callback is declared in the root of the file. How should I be referencing it from main?
I think the problem is that callback() is not defined in the same file as main().
static functions (and variables) aren’t visible across files, even if there’s a prototype or extern declaration. So, either callback() has to move to the same file as main(), or it has to lose its static’ness.
If both functions are in the same file, either callback() has to be defined first or there must be a prototype/declaration of it before main().