i find out a critical bug of MT4

 

when dll return false,

after arrive to ex4 the value become true

which is horrible ~~

i use below code in DLL

bool __stdcall Do_trade_time_DLL(int hour,double GMT8_subtract_brokerT,int day_ofweek, int day_ofweek_HK, double fluctuate_level)

{ return(false) }

and i print the value in ex4 directly, which after the line gone to DLL, but the result is 1..-->horrible~~

please amend it, stringo, thanks

 
chiwing:

when dll return false,

after arrive to ex4 the value become true

which is horrible ~~

i use below code in DLL

bool __stdcall Do_trade_time_DLL(int hour,double GMT8_subtract_brokerT,int day_ofweek, int day_ofweek_HK, double fluctuate_level)

{ return(false) }

and i print the value in ex4 directly, which after the line gone to DLL, but the result is 1..-->horrible~~

please amend it, stringo, thanks

yes, i also find out this problem in my project ~~

 
chiwing:

bool __stdcall Do_trade_time_DLL(int hour,double GMT8_subtract_brokerT,int day_ofweek, int day_ofweek_HK, double fluctuate_level)

Not an MQL bug. A bool in C++ is 1 byte (it doesn't exist in C). A bool in MQL is 4 bytes (or perhaps 2). In effect, you're trying to return a single byte of return value back to a caller who's expecting 4 (or 2) bytes.


Try changing the function declaration to either of the following (which are effectively identical because the WinSDK does "typedef int BOOL"):


BOOL __stdcall Do_trade_time_DLL(int hour,double GMT8_subtract_brokerT,int day_ofweek, int day_ofweek_HK, double fluctuate_level)

int __stdcall Do_trade_time_DLL(int hour,double GMT8_subtract_brokerT,int day_ofweek, int day_ofweek_HK, double fluctuate_level)