Discussion on "How to write a DLL for MQL5 and exchange data in 10 minutes". - page 10

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
That's the thing, the script just kicks out, how can I see the error code after that? Or the next time it's run, can it be read immediately?
In principle, the problem was solved by compiling dll for 64x. Although, after that I got more errors, but it's not important. I just needed to understand how to build and link libraries for c/s++ to mql5 in general. My example works fine now.
If you have Studio 2017 and you're looking at these instructions for your old studio and don't know what to do or how to do it, I recommend that you first read this article: https://docs.microsoft.com/ru-ru/cpp/build/walkthrough-creating-and-using-a-dynamic-link-library-cpp?view=vs-2017
Then, when you've created your dll, following the example from this article and tested it on a client application, read this instruction, starting from point 2, "In MQL5 program it should be described and called like this:". In other words, declare your dll in mt5 as it is described there.
I have solved my problem this way.
I'd like a list of type correlations between C++ and MQL in the form of macros.
#define MQL_STRING wchar_t
Here is my code in Visual Studio 2012 c++. The file main. with cpp extension (main.cpp)
Then I created a file with main extension def (main.def), which has a listof exported functions, the code looks like this :
LIBRARY "dllmt42" EXPORTS add
Then I imported it into compiler
No problems in compiling, but when you leave the EA on the chart, I get confused
Unresolved import function call, find '_add' in 'dllmt42.dll'. Total Comander sees the function as well as the compiler itself when dragging the file
Who can help, how to solve the problem with the error, after all there is a file with the extension .def which stores and is responsible for the correct export of functions?
Here is my code in Visual Studio 2012 C++. The file main. with cpp extension (main.cpp)
Then I created a file with main extension def (main.def), which has a listof exported functions, the code looks like this :
Then I imported it into compiler
No problems after compilation, but when you leave the EA on the chart, I get confused
Unresolved import function call, find '_add' in 'dllmt42.dll'. Total Comander sees the function as well as the compiler itself when dragging the file
Who can help, how to solve the problem with the error, after all there is a file with .def extension which stores and is responsible for correct export of functions?
extern "C" should be added to both declarations and implementations of exported functions, since this is C++. Otherwise, the input signatures are "plus" and MT (as well as everyone else) will not see them.
extern "C" should be added to both declarations and implementations of exported functions, since C++ is here. Otherwise, input signatures are "plus" and MT (like everyone else) will not see them.
Well, I've added it so
But still the same thing -unresolved import function call, find '_add' in 'dllmt42.dll'... I.e. I need pure C without ++?
The .def file is not needed at all. You need to duplicate the functions in the #import section in MQL
Well, yes, and did without it I saw and such, I do not go, well, show me what it is duplicated already point the way?