With the inability to go into to much detail, imagine the following situation:
You are developing a library that needs to run on various embedded platforms (AVR, ARM, etc..). Some functionality of said library needs some sort of time keeping (not an actual time but along the lines of “it is now x (mili)seconds later than the last time we were called).
When there is no operating system available, there’s no guarantee that any function that can provide this functionality is implemented (not with a universal name, at least). What would be the best practice to provide this functionality?
- Do I implement only the function header and require the application using the library to implement it?
- Do I create an init routine to which a function pointer is passed?
- Something else?
Thanks in advance.