MetaEditor HelpDeveloping programsGenerating included code

Generating include files

MetaEditor provides the function for generating include files (*.mqh) from exported functions of the current file. It makes it easy to give other users access to your functions without disclosing their source code. To do this, simply provide a generated mqh file and a closed EX4/EX5 file where the functions are implemented.

Generation process

Open an MQ4/MQ5 file and click Generate mqh file Generate Include File in the Tools menu. An mqh file is generated the following way:

  • The current open file contains all functions with the export post-modifier.
  • The include file with the #import directive and the description of detected functions is generated.
  • If no export function found, an appropriate message is displayed.
  • If a source file is located in the /Libraries folder, the module name in the #import directive has a relative path from the /Libraries directory. If a file is located in another directory, only a name of an EX4/EX5 file is substituted to #import.

If the current file is an include one (*.mqh), generation command does not work.

Generation path

The directory the mqh file is created in depends on the source file location:

  • If the current file is located in the /Libraries directory or in one of its sub-directories, the include file is generated directly in the /Include folder.
  • If a source file is located in some other directory, an include file is generated at the same location.