Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 642

 
Alexey Viktorov:

The problem is understanding what a include file is and what a library is.

The compiler "snatches" the used parts from the .mqh file and compiles an executable that will work in the absence of the .mqh file.

The library must be present on all computers that will be using a program that refers to the library. This is very inconvenient and few people use it, I do not know them.

I recommend to forget about the libraries and to understand the included files.

Well, you can argue about who is more comfortable using what!
 
Alexey Viktorov:

The problem is understanding what a include file is and what a library is.

The compiler "snatches" the used parts from the .mqh file and compiles an executable that will work in the absence of the .mqh file.

The library must be present on all computers that will be using a program that refers to the library. This is very inconvenient and few people use it, I do not know.

I recommend you to forget about the libraries and deal with the include files.

This is exactly what we are talking about.

I have provided files for this purpose.

It's not a DLL, it's an .MQ4(.EX4) file where the frequently used functions are stored.

The problem is that these functions in the EA body work without any problems,

but when you transfer them to a file connected through INCLUDE, you get the error described above.

I do not see any reason for that.

 
Sergey Maksiutenko:

That's exactly what we're talking about.

I have provided files for this purpose.

This is not a DLL, it is an .MQ4(.EX4) file where the frequently used functions are stored.

The problem is that these functions in the EA body work without any problems,

but when you transfer them to a file connected through INCLUDE, you get the error described above.

I do not see any reason for that.

I'm sorry, are you kidding me?

//+------------------------------------------------------------------+
//|                                                      my func.mqh |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"


//+++++++++++++++++++++++++++
#property strict 
//+++++++++++++++++++++++++++
#import "my_func.ex4"
int calc (int a,int b);
#import 

//+------------------------------------------------------------------+
//| defines                                                          |
//+------------------------------------------------------------------+
// #define MacrosHello   "Hello, world!"
// #define MacrosYear    2010
//+------------------------------------------------------------------+
//| DLL imports                                                      |
//+------------------------------------------------------------------+
// #import "user32.dll"
//   int      SendMessageA(int hWnd,int Msg,int wParam,int lParam);
// #import "my_expert.dll"
//   int      ExpertRecalculate(int wParam,int lParam);
// #import
//+------------------------------------------------------------------+
//| EX5 imports                                                      |
//+------------------------------------------------------------------+
// #import "stdlib.ex5"
//   string ErrorDescription(int error_code);
// #import
//+------------------------------------------------------------------+

I highlighted the line on purpose what does it tell you?!!!!

 
Vitaly Gorbunov:

I'm sorry, are you kidding me?

I highlighted the line on purpose what does it tell you?!!!!

#property strict 

Instructing the compiler to apply a special strict error-checking mode

 
Sergey Maksiutenko:

Instructing the compiler to apply a special strict error-checking regime

What does this imply?

 
Sergey Maksiutenko:

Instructing the compiler to apply a special strict error checking mode

Above I gave the direct linkhttps://docs.mql4.com/ru/mql4changes search for export

If you don't know how to use the search, this is how you can find!!!!

!!!!

Обновленный MQL4 - Справочник MQL4
Обновленный MQL4 - Справочник MQL4
  • docs.mql4.com
Начиная с билда 600 язык программирования MQL4 полностью переработан и достиг уровня MQL5 - теперь писать торговых роботов на MQL4/MQL5 можно в единой среде разработке MetaEditor и используя единые стиль, библиотеки и инструменты отладки. MQL4 пользуется заслуженной популярностью среди разработчиков автоматических торговых систем благодаря...
 

Same here!!!

#property library
//+++++++++++++++++++++
#property strict
//+++++++++++++++++++++
//=========================
int calc (int a,int b)
{
int c = a + b;
return(c);
}
Now do you see where your mistake lies?
 
Vitaly Gorbunov:

Same here!!!

Now do you see where your mistake lies?

Alas, I don't get it...

Please tell me...

 
Sergey Maksiutenko:

Alas, I don't get it...

Please tell me.

If you mean the#property library property

I've got it checked...

Without it, the library file doesn't even compile
 

I'm going to smoke so I don't write too harshly and try to explain to you what #property strict is.

Reason: