New article at mql5.com: Getting Rid of Self-Made DLLs

 

New article Getting Rid of Self-Made DLLs is published at mql5.com:

If MQL5 language functional is not enough for fulfilling tasks, an MQL5 programmer has to use additional tools. He\she has to pass to another programming language and create an intermediate DLL. MQL5 has the possibility to present various data types and transfer them to API but, unfortunately, MQL5 cannot solve the issue concerning data extraction from the accepted pointer. In this article we will dot all the "i"s and show simple mechanisms of exchanging and working with complex data types.

Author: Alex Sergeev

 

The aforementioned tasks are easy to accomplish in MQL4 too:

  • How to transfer a complex data type (for example, structure) to API function

Use integer arrays for structs. Array are always passed by reference, never by value. You even might put strings in integer arrays.

  • How to work with the pointer that is returned by the API function.

If it's any kind of C/C++ structure you know the size of the memory block the pointer is pointing to. memcpy() and/or ReadProcessMemory() are your friends.

If it's a string pointer and you don't know the size/length you can use the DLL functions delivered with every MT4 installation. ExpertSample.dll has the tools to read a string from a char pointer.


pp

Reason: