..., so I might have done some beginner errors.
indeed it was a beginners error :)
this page helped me solving the problem.
the attached archives shows how to copy strings from a DLL to MQL5
![How to Exchange Data: A DLL for MQL5 in 10 Minutes How to Exchange Data: A DLL for MQL5 in 10 Minutes](https://c.mql5.com/36/51/how-to-exchange-data-a-dll-for.jpg)
How to Exchange Data: A DLL for MQL5 in 10 Minutes
- www.mql5.com
Now not so many developers remember how to write a simple DLL, and what are special features of different system binding. Using several examples, I will try to show the entire process of the simple DLL's creation in 10 minutes, as well as to discuss some technical details of our binding implementation. I will show the step-by-step process of DLL creation in Visual Studio with examples of exchanging different types of variables (numbers, arrays, strings, etc.). Besides I will explain how to protect your client terminal from crashes in custom DLLs.
Files:
dllTest_working.zip
20 kb
No, that's why I started implementing the message transfer in C++ and want to call the DLL, which worked in a test application but unfortunately I haven't found the time to make use of it in MQL5 ...
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hi,
I'm quite new to MQL5 and would like to exchange data with a socket server implemented in Python.
As I faced a lot of issues with the Socket of MT5 I decided to implement an additional layer for communication written as DLL in C++ exporting some functions to be used in MT5.
Unfortunately even a very basic test fails where I just try to return a string making use of it in MT5.
What I did in mq5 is
When debugging, the process seems to die once executing the mt5dlltest_msg() call.
The C++ implementation is the following:
Everything needed to test my set-up, like source, cmake configuration, mt5 including a test console programm calling the function shown is part of the attached zip archive.
Might it be, that I cannot make use of std::string objects to exchange data?
I started with the return value of a chonst char * but the console test program printed strange signs which I guess is caused by the heap management. Returning a pointer to a piece of memory allocated in a DLL might not be the best idea.
I haven't developed C++ since ~10years, so I might have done some beginner errors.
Looking forward to get your comments. :)
Thanks in advance
laiki