Returning a char* string from a DLL in MT4 eats memory - page 3

 

My solution:

//C++

extern "C" __declspec(dllexport) const wchar_t *GetMessage();

const wchar_t *GetMessage()

{

    static std::wstring last_message;

    last_message = GetSomeMessage();

    return last_message.c_str();

}



//MQL

string GetMessage();

string message = GetMessage();