MQL-ZMQ. Method destroy into GlobalHandle class does not exist after MT5 build 2375 31/Mar/2020

 

Hello,

Please, I'm using ZeroMQ bind to MT5: https://github.com/dingmaotu/mql-zmq

But after version MT5 build 2375 31/Mar/2020 I get a compilation error to the same project (compiling and working before build 2375) because the method HandleManager::detroy() can not be decalred/identified.

Please, I'm not finding information about the new implementation of HandleManager (it should implement 2 static methods: create & destroy). Had the method 'destroy' been removed?

I opened this issuer: https://github.com/dingmaotu/mql-zmq/issues/47 but no response.

Please, Anybody have any information about changes into MT Handle method to EA threads?

Thanks a lot!

 
Same problem. After update to build 2485 5 june 2020
 

Same issue here. Guess it's the template class handling by new compiler. Since there's only one usage in the whole project, I just eliminated this layer and moved directly to the Context class, and it works well so far.

  1. Comment out the whole definition of class GlobalHandle in mql/lang/GLobalVariables.mql
  2. Modify the class Context in zmq/Context.mqh as below.

class Context
{
private:
   CriticalSection   m_cs;
   string            m_refName;
   string            m_counterName;
protected:
   intptr_t          m_ref;

protected:
   int               get(int option) {return zmq_ctx_get(m_ref,option);}
   bool              set(int option,int optval) {return 0==zmq_ctx_set(m_ref,option,optval);}

public:
   intptr_t          ref() const {return m_ref;}
   static intptr_t   create() {return zmq_ctx_new();}
   static void       destroy(intptr_t handle) {if(0!=zmq_ctx_term(handle)) {Debug("failed to terminate context");}}

                     Context(string shared=NULL);
                     ~Context();

   bool              shutdown() {return 0==zmq_ctx_shutdown(m_ref);}

   int               getIoThreads() {return get(ZMQ_IO_THREADS);}
   void              setIoThreads(int value) {if(!set(ZMQ_IO_THREADS,value)){Debug("failed to set ZMQ_IO_THREADS");}}

   int               getMaxSockets() {return get(ZMQ_MAX_SOCKETS);}
   void              setMaxSockets(int value) {if(!set(ZMQ_MAX_SOCKETS,value)){Debug("failed to set ZMQ_MAX_SOCKETS");}}

   int               getMaxMessageSize() {return get(ZMQ_MAX_MSGSZ);}
   void              setMaxMessageSize(int value) {if(!set(ZMQ_MAX_MSGSZ,value)){Debug("failed to set ZMQ_MAX_MSGSZ");}}

   int               getSocketLimit() {return get(ZMQ_SOCKET_LIMIT);}

   int               getIpv6Options() {return get(ZMQ_IPV6);}
   void              setIpv6Options(int value) {if(!set(ZMQ_IPV6,value)){Debug("failed to set ZMQ_IPV6");}}

   bool              isBlocky() {return 1==get(ZMQ_BLOCKY);}
   void              setBlocky(bool value) {if(!set(ZMQ_BLOCKY,value?1:0)){Debug("failed to set ZMQ_BLOCKY");}}

   //--- Following options is not supported on windows
   void              setSchedulingPolicy(int value) {/*ZMQ_THREAD_SCHED_POLICY*/}
   void              setThreadPriority(int value) {/*ZMQ_THREAD_PRIORITY*/}
  };
  
Context::Context(string shared=NULL)
         :m_cs(shared)
{
   m_refName = m_cs.getName()+"_Ref";
   m_counterName = m_cs.getName()+"_Count";
   if (!m_cs.isValid())
      m_ref = this.create();
   else
   {
      m_cs.enter();
      if (!GlobalVariable::exists(m_counterName))
      {
         GlobalVariable::makeTemp(m_counterName);
         GlobalVariable::set(m_counterName,0);
      }
      if (long(GlobalVariable::get(m_counterName))==0)
      {
         m_ref=this.create();
         if(!GlobalVariable::exists(m_refName))
         {
            GlobalVariable::makeTemp(m_refName);
            GlobalVariable::set(m_refName,m_ref);
         }
      }
      else
      {
         m_ref=(intptr_t)(GlobalVariable::get(m_refName));
      }
      GlobalVariable::set(m_counterName,GlobalVariable::get(m_counterName)+1);
      m_cs.leave();
   }
}

Context::~Context()
{
   if (!m_cs.isValid())
   {
      this.destroy(m_ref);
      return;
   }

   m_cs.enter();
   GlobalVariable::set(m_counterName, GlobalVariable::get(m_counterName)-1);
   if (long(GlobalVariable::get(m_counterName))==0)
   {
      this.destroy(m_ref);
      GlobalVariable::remove(m_refName);
      GlobalVariable::remove(m_counterName);
   }
   m_cs.leave();
}
 
Do you understand that it's not here you need to ask for support ? Contact the author of the wrapper library directly or through github, eventually talk to the ZeroMQ team.
 
pangfat:

Same issue here. Guess it's the template class handling by new compiler. Since there's only one usage in the whole project, I just eliminated this layer and moved directly to the Context class, and it works well so far.

  1. Comment out the whole definition of class GlobalHandle in mql/lang/GLobalVariables.mql
  2. Modify the class Context in zmq/Context.mqh as below.


Thanks, mate,

This is really helpful. Despite some obtuse comment about where you should or should not post the solution.

Reason: