Download MetaTrader 5

Problem with #import library (Win XP, build 646)

To add comments, please log in or register
Pavel Soukup
560
Pavel Soukup  

Hi guys,

I have problem with  #import function on pc with system Win XP (!) On pc with system Vista the same code working ok

My code library:  ..\MQL4\Libraries

#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property library

 int My(int value,int value2) export
   { value+=10;
    return(value+value2);
   }

 My code script:  ..\MQL4\Scripts

#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

#import "UTM.ex4"
  int My(int value, int value2);
#import

void OnStart()
  {
    Alert("Script..",My(10,10));
  }

 

Both compile is ok but after run script on graph, window terminal -> Strategy write:

2014.06.20 09:12:29.109 unresolved import function call

2014.06.20 09:12:29.109 Cannot find 'My' in 'UTM.ex4'


Thank you for help! 

 


qjol
3243
qjol  
is the name of the file \MQL4\Libraries\utm.ex4 ?
Pavel Soukup
560
Pavel Soukup  
Pavel Soukup
560
Pavel Soukup  

Hi guys,

new information about this problem ... maybe for others..

I don´t know why but if close row in library code

#property strict 

my script works ok.

d4v3
35
d4v3  

I have the same problem - compiling a 120KB library file without #property strict will compile with no errors and generate a 212KB ex4 file. Adding #property strict will also compile with no errors but the ex4 file is only 10KB, and the EA reports missing functions.

Also, I don't know if this is intentional, but if the library file includes an mqh file which has #property strict then the library file will still use the strict property (even though it does not have the #property strict itself). The MQL4 reference says that any property in an include file is completely ignored.

flexie
115
flexie  

Yes, I am now getting the same thing. Only started recently using the same files I've used for over a year. And, on my XP machines, but not on the Win 7 machine.   This has now rendered my systems useless.  Interestingly, dropping the indicator and/or EA on the chart it works. But after saving to a template then dropping on another chart, the new chart throws up these errors.

Running build 711. A prompt solution would be greatly appreciated. Thank you.

This is where the ability to disable auto-update would really really save a lot of grief. hint hint.

AN UPDATE, IF IT HELPS :::

Moving the functions from a called library directly into the include file makes them "findable" during runtime, hence all works ok. Has a process during compilation changed recently? and should we then move ALL functions to include files ... in other words, are libraries now obsolete?

To add comments, please log in or register