Download MetaTrader 5

call imported dll function from a class executes much slower than from a script?

To add comments, please log in or register
Amir Yacoby
1195
Amir Yacoby  

Hi,

I re-wrote a script from procedural to object oriented.

I noticed that a dll function call from the script (the import in the global scope) 

is much faster (about 5 seconds per call) than when calling the same function (less than a second)

from a class (the import is in the class global scope).

Is that so, and what is the fastest way to call a dll function from a class?

Does it matter in what scope the import statement is placed? (the class global scope, or some other) for performance? 

 

thanks. 

Ilyas
1208
Ilyas  

Hi,

The speed of function call from DLL should not differ in both cases. Perhaps, this is caused by something else.

1. Tell us, what parameters has the imported function.
2. Check that the function is called with the same parameters.

Amir Yacoby
1195
Amir Yacoby  

thanks for the answer

1. the parameters are: int, double array (by reference), double array (by reference)

    the arrays are passed after ArrayResize is performed on them, both cases with the same size (19 for the first, 1 for the second).

2. the dll function called is the same, but there is a possibility for some other difference, seems low chance though but I will further check.

Thank you again 

 

To add comments, please log in or register