dingmaotu / mql-zmq

ZMQ binding for the MQL language (both 32bit MT4 and 64bit MT5)
Apache License 2.0
544 stars 298 forks source link

Error when try to use in MQL5 #4

Closed Janderson closed 7 years ago

Janderson commented 7 years ago

Hello,

i tried to build to zmq to mql5, I already copy the right dll files to Libraries folder, but i keep got this error. screenshot_715

dingmaotu commented 7 years ago

Refer to issur #1: You need to upgrade your MetaTrader (to latest version). Newer versions allow function parameters to be static array. This ensures type safety. If you can not find a a version that support this feature, you can modify the following macro definition (in SocketOptions.mqh line 173-178)

//--- for curve key
#define SOCKOPT_CURVE_KEY(KeyType,Macro) \
   bool              getCurve##KeyType##Key(uchar &key[32]) {size_t len=32; return getOption(Macro,key,len);} \
   bool              getCurve##KeyType##Key(string &key) {return getStringOption(Macro,key,41);} \
   bool              setCurve##KeyType##Key(const uchar &key[32]) {return setOption(Macro,key,32);} \
   bool              setCurve##KeyType##Key(string key) {return setStringOption(Macro,key);}**

Just change key[32] to key[], then you will be fine. Remember the key is 32 bytes.

Janderson commented 7 years ago

I don't know, I'm using the build 1616. But change key[32] to key[], works fine. Thanks