User customization of a static library vs re-entrancy

Viewed 42

I want to create a static library in GCC (Basically AVR-GCC). But certain parameters I want allow user to change. For example, I will create a library for keypad interface. In this library, timeout value and enter key can be different depending on user's need. At present I have gone for #define value for enter key and timeout in keypad.h file. But when I go for static library, the value for enter key is decided during compile time of the libary if I am not mistaken. So even if user change the value of enter key in keypad.h, it will not be considered by the library. So I thought of going for initializeKeypad() function wherein this function will set the values for enter key and timeout defined globally. But when I do this, re-entrancy will be lost. So only option is to pass all user configurable parameters to initializeKeypad() function right? Any other better way?

1 Answers
Related