Download MetaTrader 5

Passing strings from DLL to MQL5

To add comments, please log in or register
268615
35
268615  

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
9940
Janusz Trojca  

Hi,

Try this:

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

Hi,

Try this:

tried that already but still unsuccessful.
268615
35
268615  
268615:
tried that already but still unsuccessful.

Here is the function

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

{

 return ("MQLMySQL v2.0");

InvestSoft
9940
Janusz Trojca  

A small correction:

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

{

 return (L"MQLMySQL v2.0");

} 
To add comments, please log in or register