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

 
Seric29:

Well, yes, I've seen it without it as well, it doesn't work for me, well, show me what to duplicate, will you point me in the right direction?

https://github.com/Roffild/RoffildLibrary/blob/master/Libraries/Roffild/PythonDLL/public.h

https://github.com/Roffild/RoffildLibrary/blob/c38ba6babd0935704fd30abeb58b953e33ede3e9/Include/Roffild/PythonDLL.mqh#L16

I used this approach so as not to duplicate code in different files.

 
Roffild:

It's not something I can do.

 
What libraries do I need to include in c++ to pass dates and strings to the dll, and how do I work with colours in c++?
 
Seric29:
What libraries do I need to include in c++ to pass dates and strings to dll, and how do I work with colours in c++?

None are needed. __time64_t (datetime) and wchar_t (string) are standard types. The analogue for colour is COLORREF.

 
Ihor Herasko:

None are needed. __time64_t (datetime) and wchar_t (string) are standard types. The analogue for color is COLORREF.

Can't you guys show me how this variable is declared and how its values look like using your recommendations? For dates it must be__time32_t because I'm using 32. Show me how to declare__time32_t, how to declare variable storing date and how it looks like and the same for colours. With strings, I do this

#include<string>

using std::string;

string l="123456 ";

For the dates advised #include<chrono>, but it does not work, but about the colours were given advice even more complicated even write about it will not.

 
Oh, yeah?! ... It's a lot tougher than a log. I've been poking around with the same thing for three days; I've changed everything, renamed it, rearranged it, twisted it all so that even the bedbugs in my brain space stopped panting and resigned themselves to the futility of their undertaking, spat on everything and went to my neighbours, taking a leave of absence; having come to the unequivocal conclusion that there's something cooler than their fleeting obscurantism: playing the psaltery, dancing to the balalaika with tambourines and timpani in B-flat major; it's clearly some kind of alien chant... ?! And it was because I didn't check the box in theterminal settings: Tools/Settings/Advices/Allow to import DLL. Oh, man... . And to top it all off I can't figure out: maybe I've done everything right most of the time... I could repeat the whole process, but I can't remember what I've done and how I've done it... . It gets worse... . Here everything works and works on different studios. The only thing I don't understand is the connection to "C" language and interaction with structures and classes, which means, you won't be able to put them there, but it only occurred to me to try and write "CPP" instead of "C" and try... I guess I have to write everything somewhere along the way. Good lesson. Good luck to all. Tried it, it doesn't work with this "CPP", but the class interaction inside the DLL itself makes it all work.
Настройки платформы - Начало работы - MetaTrader 5
Настройки платформы - Начало работы - MetaTrader 5
  • www.metatrader5.com
Торговая платформа обладает множеством настроек, что позволяет организовать работу в ней так, как это удобно именно вам. Выполните команду " Настройки" меню "Сервис" или нажмите "Ctrl+O". Графики — общая настройка отображения ценовых графиков, а также настройка параметров управления объектами: выделение объектов после их создания, немедленная...
 
P.S: I delete erroneous files at once and don't even remember almost any error, (This is when I'm going to make a DLL myself), but not always, for some reason?!.... And there's no way I can catch it. It is related to some attributes and to Windows Kits with winnt.h library information of course can be found on the fly if you translate your browser to English search, but yesterday I tried a little search and something without success. I personally believe that somewhere in the settings of the project to cheat, or do something random, and then linker goes crazy with his movements. In general, this error for me is still at the edge of obscurity ..., although there is an option, now quickly make mura that it would produce this error and look at your code and analyze ... . Most likely I will do so. But not right away, but gradually, or my brain will burn out completely and there is not much left. Good luck to all. P.S.: I forget about Microsoft Docs, and it has everything, now I glanced and already found an interesting, it says that somewhere I have not added the expression #define. Oh, I forgot about Docs. Fuck that google... .
 
How to implement datetame and colour variable in C++ dll library? How to call Print() function in dll what to replace it with, because c++ doesn't have it?
 
Ihor Herasko:

None are needed. __time64_t (datetime) and wchar_t (string) are standard types. The analogue for color is COLORREF.


So, let's see how it works, shall we?

 
Seric29:
How to implement datetame and color type variable in c++ dll library? How to call Print() function in dll what to replace it with, because c++ doesn't have it?

Print() is a function available only in mql4 and mql5. It cannot be replaced directly, because the output device for it is a log file of the terminal. But it can be called indirectly, if you send a corresponding command to the Expert Advisor (indicator, script), to which the dll is connected. It depends on how the data exchange between dll and the Expert Advisor is implemented.

Also, if there is a task to print something somewhere, not necessarily in terminal journal, there are a lot of possibilities for this: file, printer, display in the end.

Reason: