2026-01-25 6:06 AM
Ports definition in main.h forced to include too mutch in dependend source files when one needs ports definition only.
More convenient dedicated header file with ports definition only. Something like ports.h.
It would be nice to have more layered structure.
2026-01-25 9:46 AM
What is inconvenient about main.h including everything you need in terms of handles? You don't have to use what you don't need. It's the same with any library out there.
2026-01-25 9:06 PM
Module structure should form acycled directed graph.
Module with main.c has includes of application modules. These includes create dependencies from main module to application modules.
Ports info is common used data.
Whem application module needs port info and use include main.h, dependancy in opposite direction is created. Cycle dependancies. It is bad design. If ports info is moved to separeted module, it can be included in any module without creation of cycle dependancies. Include of ports.h don't create dependancy on main module. Module witn ports.h don't nave any dependancy. No cycle dependancies are created. Code generator generate code without layered structure.
2026-01-26 6:26 AM
main.h doesn't create cyclic dependencies. If you add them to your project, that is your own responsibility, not main.h
The #pragma once or include guard will avoid including a file more than once.
2026-01-26 6:50 AM
@vybor wrote:Ports definition in main.h forced to include too mutch in dependend source files when one needs ports definition only.
Does it ?
What, exactly, do you think it includes which it shouldn't ?
Are you using the option to generate .c & .h file pairs for generated code?
With that option enabled, it seems to be that the port defines are pretty well the only thing in main.h ?