Thanks in advance!
So, what you're saying is that as a good practice, you create the include calls like this:
#ifndef base-header-file #include "base-header-file.mqh" #define base-header-file #endif
Also, when you say that you could also use the library's binary as a shared resource in another project, I'm guessing you're referring to compiling the file into a .ex4/5 file, most likely from a .mq4/5 file instead of a .mqh file, I'm also guessing you mean too that you use your library that has includes that might be duplicated by other resources in addition to your library? Just want to make sure I'm understanding you correctly. :)
The only part where I got lost is on the namespace part, you mean that the libraries when imported in their compiled format are assigned a namespace that should be referenced when calling it's functions?
Thanks again for your time!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey all!
I'm doing a refactoring of my code base to improve my developer experience. I just had a thought and struggled to find any relevant information to get some clarity.
Suppose the following:
So far so good, I'm aware that during preprocessing, each of the files with the classes will get only one instance of the code from the base defines and the specific defines. Here's where I'm getting tangled:
Given the above suppositions, suppose the following:
The idea is that CImplementationClass would be a class that serves as a "hub" to connect the specific-to-a-task classes as they are required by the program.
However, my question is, on the example of CImplementationClass, the fact that the header files used call separately to a common files in various instances would imply that the final compilation of the program will have repeated defines or larger than needed file size, or the preprocessor takes care of analyzing the code to where if I have X #include calls to files that each use the same header file, then it will just insert that common header file once?
I notice this is a programming pattern in many large libraries, including the standard library, for example, if I build a dialog window (let's call it CExampleDialog) using CAppDialog, and include the ComboBox.mqh and DateDropList.mqh controls, since both files contain a #include "WndContainer.mqh" I'd end up on a similar situation. Since I see the pattern being used in many instances, I decided to use it as well, but before doubling down on a structure I'd like to make sure I'm using the proper practices.
Thanks in advance!!