OpenTrading / OTMql4Zmq

Open Trading Metatrader 4 ZeroMQ Bridge
MIT License
99 stars 46 forks source link

uAnsi2Unicode - function not defined on OTMql4Zmq.mqh #19

Open mglcampos opened 8 years ago

mglcampos commented 8 years ago

Metatrader says it cannot open mql4Zmq.ex4 file. First I fixed the import on the OTMql4Zmq.mq4 expert advisor so it includes OTMql4Zmq.mqh. But then when I compile both .mqh and .mp4 I get errors. "uAnsi2Unicode - function not defined on OTMql4Zmq.mqh" I used dependency walker to check the mql4zmq.dll and it says: "Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module." I tried everything from putting all the required .dll's in the same folder or different versions and nothing works I am working on Linux, running Metatrader 64 bit, build 1010 with wine. I am using the pre-compiled libs from git.

mglcampos commented 8 years ago

I fixed this by creating the function myself, here it is the code below:

string uAnsi2Unicode(int ptrStringMemory)
{
  int szString = lstrlenA(ptrStringMemory);
  uchar ucValue[];
  ArrayResize(ucValue, szString + 1);
  RtlMoveMemory(ucValue, ptrStringMemory, szString + 1);
  string str = CharArrayToString(ucValue);
  LocalFree(ptrStringMemory);
  return str;

}