Thanks,
now I debug this DLL with a console win32 app, char* which is error using, but not induced MTdead.
but why int& st and int& prd made MT dead ?
with console win32 app, can sure that int& st and int& prd can be assign value and return OK inside DLL.
Thanks,
now I debug this DLL with a console win32 app, char* which is error using, but not induced MTdead.
but why int& st and int& prd made MT dead ?
with console win32 app, can sure that int& st and int& prd can be assign value and return OK inside DLL.
Sorry I did not read the whole thing very carefully but in my experience MT4 does not like it when you try to resize its variables in a dll ...
I had similar issues trying to fill out an array, the array had to define and of the right size before my dll could successfully fill it up.
So for a test try setting in MT4 you string which variable to which = "0000000";
Then have it call your dll function and it will most likely work this time ...
Patrick
MT4_EXPFUNC char*__stdcall GetState(int& st,char* which,int& prd)
in such function, MT dead if let st= 123;
MT4_EXPFUNC char*__stdcall GetState(int* st,char* which,int* prd)
in such function, MT no dead.
Both do not change parameters st, which, prd.
only can return soththing with return(.....);
only use array to return multi variables.
This is conclusion !!!
who have other opinion?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Can not return var by parameter from functions in DLL ???
there are a function in DLL,
======================
MT4_EXPFUNC char*__stdcall GetState(int& st,char* which,int& prd)
{
//st = 1;
which = "EURUSD";
// prd = 5;
return (which);
}
====================
if I call such function in a script: MT version 224
string which = "000", ss="";
int a=0,b=0;
ss = GetState(a, which,b);
Print (ss," ", which);
get ss "EURUSD", which still is "000" !!!!!!!!!!!!!!!!
--------------------------------------------------
if I change GetState function to
======================
MT4_EXPFUNC char*__stdcall GetState(int& st,char* which,int& prd)
{
st = 1;
which = "EURUSD";
prd = 5;
return (which);
}
====================
MY GOD! MT deaded!!!!!!!!!!! and now, MT do not allow debug DLL when MT runing ! so I can not debug what happon in DLL!! in so simple code!!!!
--------------------------------------------------
Who know why ?