-
February 10th, 2013, 02:04 AM
#1
Need Help please
What do i do wrong here?
I have Mq4 platform calling functions from DLL some how it doesnt make any differents when I make the call....
// DLL Code
#define WIN32_LEAN_AND_MEAN
#define MT4_EXPFUNC __declspec(dllexport)
using namespace std;
std::string My_String;
#define stringify(mymonths ) # mymonths
#pragma pack(push,1)
struct RateInfo { unsigned int ctm; double open; double low; double high; double close; double vol; };
struct MqlStr { int len; char *string; };
#pragma pack(pop)
int BarsCount = 2000;
MT4_EXPFUNC bool _stdcall StartRulls(int bars)
{
bool result = false;
if (bars > BarsCount) result = true;
return(result);
}
//Mqh Lib File /* My_Lib.mqh */
#import "My_DLL.dll"
bool StartRulls(int bars);
#import
//mq4 code My_Mq4.mq4
#include <My_Lib.mqh>
I call this function
bool counts = StartRulls(bars);
Print("counts =",counts );
2013.02.09 23:03:24 2010.03.31 16:37 My_Mq4.mq4 EURCAD,M5: counts = 1
My result always stays 1
-
February 10th, 2013, 03:37 AM
#2
Re: Need Help please
Originally Posted by MT4_EXPFUNC
I call this function
Code:
bool counts = StartRulls(bars);
Print("counts =",counts );
2013.02.09 23:03:24 2010.03.31 16:37 My_Mq4.mq4 EURCAD,M5: counts = 1
My result always stays 1
I have no idea what this function Print does, but bool type can take only two values: either true or false. So what else info are you trying to get from it?
Victor Nijegorodov
-
February 10th, 2013, 04:01 AM
#3
Re: Need Help please
My DLL does receives numeric number based on my bars on my chart, so when it counts over 2000 , I want my bool value change from 0 to 1 or from false to true.... bars always reads from mt4 functions " Bars " which I use to get bars counts value from mq4 pass it over to dll check the bar value, if bars are more then 2000 then change the return value....
-
February 10th, 2013, 04:05 AM
#4
Re: Need Help please
My DLL does receives numeric number based on my bars on my chart, so when it counts over 2000 , I want my bool value change from 0 to 1 or from false to true.... bars always reads from mt4 functions " Bars " which I use to get bars counts value from mq4 pass it over to dll check the bar value, if bars are more then 2000 then change the return value.... Thank you so much for the reply !!
-
February 10th, 2013, 05:50 AM
#5
Re: Need Help please
Originally Posted by MT4_EXPFUNC
My DLL does receives numeric number based on my bars on my chart, so when it counts over 2000 , I want my bool value change from 0 to 1 or from false to true.... bars always reads from mt4 functions " Bars " which I use to get bars counts value from mq4 pass it over to dll check the bar value, if bars are more then 2000 then change the return value.... Thank you so much for the reply !!
First, use code tags when posting code. The code you posted is unformatted and practically unreadable.
Second, you didn't show us a complete program. Where does "bars" come from when you call the DLL function? It just pops up out of nowhere -- who knows where it comes from, what value it has, where it was declared, nothing. How are we to know if your function works if the argument you're passing to it is not known by anyone looking at your post?
Code:
#include <My_Lib.mqh>
#include <iostream>
using namespace std;
int main()
{
cout << StartRulls(1) << "\n" << StartRulls(2001) << "\n";
}
So what does this print? Note that there are no unknowns such as a mysterious "bars" variable. I called the function with known values to see what happens.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; February 10th, 2013 at 05:53 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|