Memory problems while compiling an expert with an #import

 

Hi there,
I'm pretty new here and hope that this question is not that stupid. It's clear to me that I'm missing a tiny issue.

I wrote an expert (let call it expert.mq4) and within it imported an mql4 library I wrote (let say the compiled library is library.ex4).
So, in the expert I wrote:

#import "library.ex4"
int somefunction(int input);

When I compile the expert.mq4 file I get:
memory handler - Cannot allocate ~1GB of memory.

(If I omit the call to the somefunction, it compiles fine.)

Thanks,

Eyal

 
rotheyal:

Hi there,
I'm pretty new here and hope that this question is not that stupid. It's clear to me that I'm missing a tiny issue.

I wrote an expert (let call it expert.mq4) and within it imported an mql4 library I wrote (let say the compiled library is library.ex4).
So, in the expert I wrote:

#import "library.ex4"
int somefunction(int input);

When I compile the expert.mq4 file I get:
memory handler - Cannot allocate ~1GB of memory.

(If I omit the call to the somefunction, it compiles fine.)

Can u post that function? Are there any recursive calls anywhere in the code?

 
gordon wrote >>

Can u post that function? Are there any recursive calls anywhere in the code?



No recursive calls as far as I understand the flow.


It happends even with a simple function:

in library:

bool validateTimeFrame(int timeFrame)
{
return (timeFrame == 0 || timeFrame == 1 || timeFrame == 5 || timeFrame == 15 ||
timeFrame == 30 || timeFrame == 60 || timeFrame == 240 || timeFrame == 1440 ||
timeFrame == 10080 || timeFrame == 43200);
}

A simple call in expert (in init()):

validateTimeFrame(0);

 
If u move all library functions back to your main file - does it compile?
 

Yes it does.

 

I think that the problem is that I didn't include the library or declared it in the right way, but I can't figure out what's wrong.

 

Is the "#property library" is needed in the library? (I do use it)

 
yes
 
rotheyal:

I think that the problem is that I didn't include the library or declared it in the right way, but I can't figure out what's wrong.

Maybe, but the error u got ("memory handler - Cannot allocate ~1GB of memory") doesn't make any sense in that regard...

Can u attach your files? Maybe I'll think of something...

 

Attached is a modified version for your check.
Thank you very much for the effort :)

Files:
experts.rar  3 kb
 
The #import statement was wrong in this version... Instead of:
#import "reUtil.ex4"
  bool validateTimeFrame(int timeFrame);
It should be:
#import "reUtilAttach.ex4"
  bool validateTimeFrame(int timeFrame);
#import

Both library and expert compile with no errors or warnings. I tried running the expert for a few minutes with no problems...