and the definition/initialization of the structure in one of the modules looks like
const struct footype foo PROGMEM = {...};
It seems to work, but I get warnings during linking that "type of 'foo' does not mach original declaration". (There are no pointers to strings in the structure, so it's not that old problem.)
What's the right way to do this to avoid the warnings?
Well, in trying to make a trivial test case I got a lead on what the problem is, and it's out of left field: the module which has the structure definition has a ".c" file extension instead of a ".cpp" file extension! I don't entirely understand the implications of that (I'm really writing in the C subset of C++), but at least now I can fix it.
Thanks for pushing me to work on a simple test that shows the problem.
What do you mean with "several modules" ? Not used to the Arduino way yet ?
The *.ino files are combined together, you only need to include a *.h file in the first *.ino file.
In C++, the struct footype {...}; is already a typedef.
The Arduino pre-processes the files before compiling it.
That preprocessor tries to be "smart", and sometimes that gets in the way. So it might be needed to make a workaround for the preprocessor, even if the code itself is fine.