In c you don't need to call anything your files at all. That way you can call your mylongheadername.h header when you call your original ac file and have a function in it called justArandomFunctionName .
However, you should be aware that your source file must include your header file. As a rule, there is a strong connection between the headers and the source files, so the reason for this is always done like this. However, the following is quite true:
ac : func1 implementation func2 implementation bc : func3 implementation func4 implementation ch : func1 declaration func3 declaration dh : func2 declaration func4 declaration
However, there are some problems for this approach that may arise when using files configured in this way (which means that you must do the extra work of structuring these files correctly), and this is just bad practice. But the way to use the header files is just a convention, and hardly any of them are forced by the language.
The question then becomes how this can work if the header file does not know where the function is defined. The idea behind this is that you don't need to know it.
Basically, your entire header tells your compiler that somewhere you defined a function that matches a specific profile (what name, what parameters, what type of return). When your compiler reads this, basically everything that it does, mixes all this information into a fancy name, which will then be inserted into the calling file, which means that it does nothing anyway. The next step you need to take is to use the linker to turn the compiled versions of each of your files into one executable. It does a few things, but one of the most important is that it resolves all these fancy names that compiles. However, the way your linker works is that it simply reads all the compiled versions of your files and compares the definition of the functions with their actual location in another code. Since it just processes everything that you have at the same time, it doesn't matter where your functions were defined, and the header file should never know about it.
source share