Discussion of article "A DLL for MQL5 in 10 Minutes (Part II): Creating with Visual Studio 2017"

 

New article A DLL for MQL5 in 10 Minutes (Part II): Creating with Visual Studio 2017 has been published:

The original basic article has not lost its relevance and thus if you are interested in this topic, be sure to read the first article. However much time has passed since then, so the current Visual Studio 2017 features an updated interface. The MetaTrader 5 platform has also acquired new features. The article provides a description of dll project development stages, as well as DLL setup and interaction with MetaTrader 5 tools.

Creating a simple DLL

The whole process was already described in the original article. Now we will repeat it taking into account software updates and changes.

Open Visual Studio 2017 and navigate to File -> New -> Project. In the left part of the new project window, expand the Visual C++ list and select Windows Desktop from it. Select the Windows Desktop Wizard line in the middle part. Using entry fields at the bottom part, you can edit the project name (it is advisable to set your own meaningful name) and set project location (it is recommended to keep as suggested). Click OK and proceed to the next window:


Select Dynamic Link Library (.dll) from the drop-down list and check "Export Symbols". Checking this item is optional, but beginners are recommended to do so. In this case, a demo code will be added to the project files. This code can be viewed and then deleted or commented. A click on "OK" creates project files, which can then be edited. However, first we need to consider the project settings. Firstly, remember that MetaTrader 5 only works with 64-bit libraries. If you try to connect a 32-bit DLL, you will receive the following messages:

'E:\...\MQL5\Libraries\Project2.dll' is not 64-bit version
Cannot load 'E:\MetaTrader 5\MQL5\Libraries\Project2.dll' [193]

Thus you will not be able to use this library.

Author: Andrei Novichkov

 
Can i create custom menus within Metatrader with a c++ dll?
 
No)
Reason: