Download MetaTrader 5

Passing strings from DLL to MQL5

To add comments, please log in or register
What are the latest MQL5.community news? The Wall section will tell you!
268615
35
268615 2015.01.13 09:39 

Hi, 

   I have developed a DLL in VS 2010 ( Uses Unicode Character Set ) and am trying to pass string (wchar_t*) from the DLL  function as return value but have failed in every attempt. Need help to get this issue resolved. 

e.g DLLAPI wchar_t* __stdcall cMySqlVersion() 

InvestSoft
8548
Janusz Trojca 2015.01.13 09:56  

Hi,

Try this:

extern "C" __declspec(dllexport) wchar_t* cMySqlVersion()
268615
35
268615 2015.01.13 09:59  
forex_trader:

Hi,

Try this:

tried that already but still unsuccessful.
268615
35
268615 2015.01.13 10:01  
268615:
tried that already but still unsuccessful.

Here is the function

extern "C" __declspec(dllexport) wchar_t* __stdcall cMySqlVersion()

{

 return ("MQLMySQL v2.0");

InvestSoft
8548
Janusz Trojca 2015.01.13 10:12  

A small correction:

extern "C" __declspec(dllexport) wchar_t* __stdcall cMySqlVersion()

{

 return (L"MQLMySQL v2.0");

} 
To add comments, please log in or register