"arrays passed by reference only" How do you solve this problem

 
Friends please help
//+------------------------------------------------------------------+
//| ExportFunctions.mq4 |
//| Copyright ?2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#include <pluginAB.mqh>

#define TIME_INDEX 0
#define OPEN_INDEX 1
#define LOW_INDEX 2
#define HIGH_INDEX 3
#define CLOSE_INDEX 4
#define VOLUME_INDEX 5
#define MAX_DATA 1000
double imode;
int readlen;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
int ret;

ret=SetHost("localhost",1950);
GlobalVariableSet(Symbol()+"_len",0);
sendPrice();
return(0);
}
//+------------------------------------------------------------------+
//| array functions call |
//+------------------------------------------------------------------+
int start()
{
sendPrice();
return(0);
}
//+------------------------------------------------------------------+
int sendPrice()
{
double rates[][6];
//bool f;
double rcnt;

ArrayCopyRates(rates);
//ret=GetRatesItemValue(rates,10,1,1);
rcnt=GlobalVariableGet(Symbol()+"_len");
if(rcnt==0)
{
imode=SetRateArray(rates,Bars,Symbol(),Period(),MAX_DATA); //historical mode

}else
{
imode=SetRateArray(rates,Bars,Symbol(),Period(),0);//realtime mode

}
rcnt=rcnt+imode;

if(rcnt>10) rcnt=0;
Print(rcnt);
GlobalVariableSet(Symbol()+"_len",rcnt);
return(0);
//+------------------------------------------------------------------+
//| Copyright ?2005, MetaQuotes Software Corp. |
//| #include <pluginAB.mqh> |
//+------------------------------------------------------------------+
#import "Exp.dll"
int SetRateArray(double &rates[][6],int,string,int,int);// rate array,array length,symbol name,period,readlen
// if readlen is 0, realtime mode
// if readlen>0,histrical mode

int SetHost(string,int);//IP ,port

 

-----------------------------------------------------------
'pluginAB.mqh' pluginAB.mqh 1 1
arrays passed by reference only pluginAB.mqh 2 27
variable 'f' not used pluginAB.mq4 47 9
0 error(s), 2 warning(s), compile time: 89 msec 1 3

Don't work requests for help .

‌____________________________________________________________________________

Moderator Note: P‌lease use the SRC button next time. I have edited it for you this time:

 
  1. Please use the SRC-button to post code!
  2. I have no idea why and what for you coded that, what you expect and what it does.
 
Line 2 is a comment.
//+------------------------------------------------------------------+
//| Copyright ?2005, MetaQuotes Software Corp. |
//| #include <pluginAB.mqh> |
//+------------------------------------------------------------------+
#import "Exp.dll"
int SetRateArray(double &rates[][6],int,string,int,int);// rate array,array length,symbol name,period,readlen
// if readlen is 0, realtime mode
// if readlen>0,histrical mode

int SetHost(string,int);//IP ,port
Line 47 is a comment
ArrayCopyRates(rates);
//ret=GetRatesItemValue(rates,10,1,1);
rcnt=GlobalVariableGet(Symbol()+"_len");
The code you posted, does not match the error message you provided.'pluginAB.mqh' pluginAB.mqh 1 1
arrays passed by reference only pluginAB.mqh 2 27
variable 'f' not used pluginAB.mq4 47 9
0 error(s), 2 warning(s), compile time: 89 msec 1 3
 

    Hi   whroeder1

                    

#import "Exp.dll"
int   SetRateArray(double rates[][6],int,string,int,int);// rate array,array length,symbol name,period,readlen
                                                         // if readlen is 0, realtime mode
                                                         // if readlen>0,histrical mode
                  
int   SetHost(string,int);//IP ,port

Please have a look at the error code .

'pluginAB.mq4'

'pluginAB.mq4'

arrays passed by reference only     pluginAB.mqh

Thank you very much





 

Either define this array as a 'global' array then you can access it without passing it over as a parameter to the function, or just use a reference, what's wrong with it?

"passed by reference" means only that in the function does not exists a copy of that array and all what you do with it in the function happens to the original.

 
slowloopattack:

    Hi   whroeder1

                    

Please have a look at the error code .

'pluginAB.mq4'

'pluginAB.mq4'

arrays passed by reference only     pluginAB.mqh

Thank you very much






Change to this:

#import "Exp.dll"
int   SetRateArray(double &rates[][6],int,string,int,int);// rate array,array length,symbol name,period,readlen
                                                         // if readlen is 0, realtime mode
                                                         // if readlen>0,histrical mode
                  
int   SetHost(string,int);//IP ,port
 
slowloopattack:

    Hi   whroeder1

                    

Please have a look at the error code .

'pluginAB.mq4'

'pluginAB.mq4'

arrays passed by reference only     pluginAB.mqh

Thank you very much

That is not an error - it states there that it is a warning (and a benign warning - unless you try to change some of the array elements in the called function(s), in which case you will scratch your head)

Do as honest_knave told you to avoid that compiler warning

 
Mladen Rakic:

That is not an error - it states there that it is a warning (and a benign warning - unless you try to change some of the array elements in the called function(s), in which case you will scratch your head)

Do as honest_knave told you to avoid that compiler warning

Hi   Carl Schreiber  honest_knave Mladen Rakic    

Thank you very much to help me.

pluginAB.mq4  MT4 test by now, but from the DLL data without work ,

Some of the called function is to change the array elements,

So how to change





Reason: