About include (mqh) processing

Back to topics list To post a new topic, please log in or register
sgnifus 2016.03.11 16:17

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?





gooly 2016.03.11 18:24 #
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.
WHRoeder 2016.03.11 18:44 #
  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.
sgnifus 2016.03.11 19:28 #

Ok, thank's and have a nice day.


Ovo 2016.03.11 19:37 #
The compiler loads only the first include, like the include_once command in PHP. It's changed since the 509- code.
Back to topics list  

To add comments, please log in or register