Description
Currently fpm can compile submodules after the main program gets compiled to object files.
LFortran has two modes. In separate compilation mode it compiles every file to object code (like most other compilers) and thus the order does not matter, no bug there. The other mode is direct compilation: all modules/submodules get compiled to .mod and .smod files, but no object code is generated. Then when the main program is compiled, all .mod and .smod files are loaded and everything compiled at once. This mode usually just works with fpm, as long as fpm compiles submodules before the main program. However sometimes that is not the case and then we get missing symbols at link time.
Is there a reason why submodules couldn't always be compiled before the main program? That would fix this issue completely.
Possible Solution
No response
Additional Information
No response
Description
Currently fpm can compile submodules after the main program gets compiled to object files.
LFortran has two modes. In separate compilation mode it compiles every file to object code (like most other compilers) and thus the order does not matter, no bug there. The other mode is direct compilation: all modules/submodules get compiled to .mod and .smod files, but no object code is generated. Then when the main program is compiled, all .mod and .smod files are loaded and everything compiled at once. This mode usually just works with fpm, as long as fpm compiles submodules before the main program. However sometimes that is not the case and then we get missing symbols at link time.
Is there a reason why submodules couldn't always be compiled before the main program? That would fix this issue completely.
Possible Solution
No response
Additional Information
No response