I\'m developing a hardware abstraction library for an embedded product using GCC C. Within the library there is a variable that should be read-only to the application that l
You can use pointer to get past the issue.
module.c
static int readwrite = 0; int const * const readonly = &readwrite;
module.h
extern int const * const readonly;
If there is no reason to expose address of the variable, you should prefer Lundins getter approach to have proper encapsulation.