Whats the best practice or optimum way to include large read-only data arrays like fonts and bitmaps data in a C++ embedded library, Assuming you want to have the data in separate files.
Lets imagine the following structure
test.ino
lcd.h , lcd.cpp
graphics.h graphic.cpp
font_data.h font_data.cpp
bitmap_data.h bitmap_data.cpp
3 is included into 2 and 2 is included into 1.
4 is only used in 3 and 5 is only used in 1.
Is it Ok to just have the data arrays in the .h file?
Header files pre-date C++. It's perfectly normal to put large data declarations in a .h file. It's standard procedure. No other files to support them are needed or appropriate.
I also code in C embedded (stm32, pic etc) , In C projects I am putting the Data arrays there in the .c file and sharing it with the other file that needs it with "extern" and pointers. So in C the .h file
was no data in it. See post 6 at link.
I just included the cpp files even though they are empty.
I am trying to figure out whats best practice in C++ and if I am doing something wrong.