you can change string data in previously allocated buffer. new allocation or reallocation are unsafe therefore appropriate sample code in our SamleExpert.dll is absent
So how can I send string allocated in C++ to MQL4? It will cause memory leaks right since MQ4 will not delete it by itself.
I want something like:
and the GetCPPString implementation in C++
I want something like:
string result = GetCPPString();
and the GetCPPString implementation in C++
How can I implement it so it will not cause any memory leaks or crashes?char* GetCPPString () { char* buffer = new char[100]; strcpy( buffer, "Hello..........." ); return (buffer); }

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
No ability to allocate strings inside of DLL's. I need to pass string with fixed length, and use only that number of characters.
Will you change it some day?
Ruby