Hello,
Suppose I wanted to split my code into separate modules, as is quite common for large applications. I'm talking about the sort of thing where one compiles,
gcc file1.c file2.c file3.c -o bigfile
What sort of effect does this have on performance? Does it improve or harm things? I'm concerned with this because, for example, one has to include libraries separately for each .c file---but one can of course include within each the minimum necessary.
Also, what's the standard practice for exchanging function declarations between the different modules? Does one create a header file for each along the lines of, file1dec.h, file2dec.h, etc., which can be included or excluded as necessary, or ... ? I would imagine one of the benefits of modular programming is that of all the functions in each module, one has to make other modules only aware of one or two, while the rest can remain of interest only to the module in which they are contained.
I've never really had to do this before because all my programs (number-crunching science stuff) tend to be short enough that I don't need modules; though I often "outsource" some functions to separate header files.
Any thoughts?
Cheers,
-- Joe
Suppose I wanted to split my code into separate modules, as is quite common for large applications. I'm talking about the sort of thing where one compiles,
gcc file1.c file2.c file3.c -o bigfile
What sort of effect does this have on performance? Does it improve or harm things? I'm concerned with this because, for example, one has to include libraries separately for each .c file---but one can of course include within each the minimum necessary.
Also, what's the standard practice for exchanging function declarations between the different modules? Does one create a header file for each along the lines of, file1dec.h, file2dec.h, etc., which can be included or excluded as necessary, or ... ? I would imagine one of the benefits of modular programming is that of all the functions in each module, one has to make other modules only aware of one or two, while the rest can remain of interest only to the module in which they are contained.
I've never really had to do this before because all my programs (number-crunching science stuff) tend to be short enough that I don't need modules; though I often "outsource" some functions to separate header files.
Any thoughts?
Cheers,
-- Joe