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

 
Andrey Sokolov #:

I haven't been able to import the functions yet, I described the problem in the first post on the previous page.

I'm trying to do it in a different way, as in the help

https://www.mql5.com/ru/docs/basis/preprosessor/import

I don't get it yet, I'm doing it in a wrong way, or it's not the right example.

The question is in mql4, so I don't understand it immediately, that it is a question of mql5. There is no such a thing in mql4.

Have you made a test dll?

 
Alexey Viktorov #:

The question is in the mql4 topic and I didn't immediately realise it was a question about mql5. There is no such thing in mql4.

Have you made a test dll?

What is there no such a thing?

 
Alexey Viktorov #:

The question is in the mql4 topic and I didn't immediately realise it was a question about mql5. There is no such thing in mql4.

Have you made a test dll?

At first I did it for 4, but now it is for 5 and there is the same error, no function is found in dll.


#property strict

#import "C:\Users\Андрей\source\repos\ConsoleAppForMql\TestLib\bin\Debug\TestLib.dll"
int Inc();
#import

int OnInit(){

Print("  до вызова Inc()");

int x = Inc();

Print(" Inc()  "+ (string)x);

return(INIT_SUCCEEDED);}

void OnDeinit(const int reason){

}
void OnTick(){

} 
 
Tretyakov Rostyslav #:

The example is not correct!

I started with these articles

https://www.mql5.com/ru/articles/249

https://www.mql5.com/ru/articles/5563

Thanks, I'll chew on it.

If there is a working example, I think it would make it very easy.

 
Andrey Sokolov #:

Thanks, I'll chew on it.

If there's a working example, I think it would make it very easy.

I already wrote

first post.

 
Tretyakov Rostyslav #:

I already wrote

the first post.

Thanks, haven't finished it yet.

 
Andrey Sokolov #:

Thanks, haven't finished reading it yet.

Here's a good source code for an example.

My remaining DLL questions were solved here

 
Tretyakov Rostyslav #:

What isn't there?

The kind shown in Andrei's picture.

 
Andrey Sokolov #:

First I did it for 4, but now it's for 5, and there is the same error, no function in dll


Andrei, pay attention to these words in the documentation

Не рекомендуется использовать полностью квалифицированное имя загружаемого модуля вида Drive:\Directory\FileName.Ext. 
Библиотеки MQL4 загружаются из папки terminal_dir\MQL4\Libraries. 
Если библиотека не была найдена, то производится попытка загрузить библиотеку из папки terminal_dir\experts.

it's written in mql5 documentation too. Consequently, the .dll should be in the Libraries folder. Isn't it?

Документация по MQL5: Программы MQL5 / Вызов импортируемых функций
Документация по MQL5: Программы MQL5 / Вызов импортируемых функций
  • www.mql5.com
Вызов импортируемых функций - Программы MQL5 - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Andrey Sokolov #:

I haven't been able to import the functions yet, I described the problem in the first post on the previous page.

I'm trying to do it in a different way, as in the help

https://www.mql5.com/ru/docs/basis/preprosessor/import

I can't decide yet if I am doing it incorrectly by the above example or the example is wrong.

Let's start from the beginning. What is the library you are creating for? It should be under .Net, it's indicated in the docs, by the way, and it works correctly under it. Under .Core and UWP you can try, I'm too lazy to try it myself, tell me later.


Reason: