MetaEditor Help

Generating Include Files

Generating Include Files

MetaEditor has a special feature for generating include files (*.mqh) on the basis of exported functions of the current file. To start this function, you should execute the "Generate Include File Generate Include File" command of the "Tools" menu.

The Process of Generation

The generation of a mqh file is performed in the following way:

  • In the currently open file, all functions with the export post modifier are searched for.
  • An mqh file that contains the #import directive and the description of the functions found is generated.
  • If no exported functions are found, the corresponding dialog is displayed.
  • If the source file is located in the /Libraries folder, then the module name in the #import directive will contain the path relatively to the /Libraries directory. If the file is located in another directory, #import will include only the name of the EX4/EX5 file.

If the current file is an include file (*.mqh), the command of generation is disabled.

The Path of Generation

A folder where mqh files are generated depends on location of the source files:

  • If a source file is in the /Libraries directory or in one of its subfolders, the include file will be generated in the root of the /Include folder.
  • If a source file is in another folder, the include file will be generated in the same place.

Using MQH Files

The function of generating include files allows to easily share your functions with other users without exposing the source code. To do it, it's enough to provide the generated mqh file and the EX4/EX5 file where the functions are implemented.