Download MetaTrader 5
To add comments, please log in or register
No PC at hand? Communicate with friends using your mobile phone!
maindoor
120
maindoor 2015.07.16 06:02 

Hi,

I just coded a library 'mylib.ex4' in build 840.

and moved that library to build 509 and compiled an indi using that library. It compiles fine.

The I move the indi to build 840 and attach the indi to a chart it says: cannot load external program 'mylib'

What am I doing wrong ?

I have included the library like this in the indi on build 509

#import "mylibex4"
  void myfunc (int Price);
#import
maindoor
120
maindoor 2015.07.16 11:52  

To rephrase the question: Can I use new a library from a new build to compile an indicator on an old build ?

I am able to use a library from an old build on a new build, but is the reverse true ? or is there a compatibility mode ?

whroeder1
13641
whroeder1 2015.07.16 12:04  
Code is almost never forward compatible, only backward compatible. You should always be able to compile on 509 and run on 840. Almost never the other way.
maindoor
120
maindoor 2015.07.16 16:14  

I am not trying to run on 509. Just the compilation is done on 509 with a library from 840 and then run on 840.

So something like this:

840: mylib.ex4

509: myprog.mq4 + mylib.ex4 = myprog.ex4 , compiles fine

840: run myprog.ex4, complains with error: cannot load external program 'mylib', although the mylib.ex4 is in the right path.

So as per your statement this looks a backward compatible issue.


This is my understanding, please correct me if wrong: During a compilation on 509, the compiler says is there a symbol in mylib for a function call ?

yes, I find it in mylib.ex4. Generate the binary and when it is run on 840, it just takes locates the function from the library

and starts using it. Now if call semantics of a library from an executable has changed between 509 and 840, then this problem could happen.

But I highly doubt it, because a library call is a very old concept and was verified during compilation on 509 which means it is able to locate

the symbol within the library. But then it complains during run time, that's why I thought maybe i'm doing something wrong.

JD4
1101
JD4 2015.07.17 05:02  
If I am reading it right, you are trying to use program code from build 509 (old code) with mylib.ex4 build 840 (new code) and I think WH got " You should always be able to compile on 509 and run on 840." backwards.  I think he meant compile on 840 and it would work on 509.  For it to be backwards compatible anyway, I would think 840 compile could run on 509, which is what you are doing, but somehow not the reverse.  I think that what is happening is there is some code from your program from build 509 that the 840 compile and build is having issues with from your program, even though your library file is from the 840 build.
whroeder1
13641
whroeder1 2015.07.17 11:45  
JD4:   I think he meant compile on 840 and it would work on 509.
You understand correctly but this is a reverse case. You can't expect a 509 compile to be correctly able to read the 840 mylib.ex4, therefor the 509 compile won't work on 509 or 840.
/
To add comments, please log in or register