About include (mqh) processing

 

Hi there,

Please a little elucidation about mechanism of include loading.

Let this scenario: there are some include (mqh) which in turn call other includes, i.e. relative to elementary soubroutines.

So, any include-container is an auto-independent module because it can be compiled without errors.

But a particular elemental included may be called by more of one include-container. And in general the include connections are how a tree.

For example: draw-form-input.mqh is an includer-container that require debug.mqh and draw-native-object.mqh; moreover statistical-analisys.mqh and delete-object.mqh are yper-containers that require draw-form-input.mqh and debug.mqh, and others peculiar files mqh.

Yes: it isn't necessary to recall again debug.mqh from delete-object.mqh because it is yet called by draw-form-input.mqh, but for my personal clarity I prefer to call debug.mqh in any of my mql-files: so I don't must care about structural changes.

Finally, the includes-container are called by the main procedure (mq4).

My question: during the main-procedure initialization, these elementary and repeated includes-soubroutine are loaded once or every time?

Thank's,

Francesco

 

 

 
I have no inside view but I guess what is coded in a mqh-file that was loaded by a compile option is compiled as if it were coded directly within your EA.
 
  1. Includes are not repeatedly included.
  2. Includes are compiled as if it were coded directly within your EA at the first #include.
  3. Loaded once as part of the EA because the EA is loaded once.
 

Ok, thank's and have a nice day.

 
The compiler loads only the first include, like the include_once command in PHP. It's changed since the 509- code.