Passing in values from external DLL to Metatrader

 

Hi,

I need to pass in 3 integer values from an external DLL to an EA in MetaTrader. Inside the EA, I declare the imported DLL function as:

-----------------------------------------------------------------

#import "MyLib.dll"
void Myfunc(int& value1, int& value2, int& value3);
#import

int a;

int b;

int c;

// call Myfunc to fill in the values for a, b, c.

Myfunc(a, b, c);

--------------------------------------------------------------

I have written the external function "Myfunc" to accept pointers to 3 integers as input parameters and "Myfunc" will then fill in the values into these 3 integers.

Is this possible in MQL4?

 
Jim_Trader :

Hi,

I need to pass in 3 integer values from an external DLL to an EA in MetaTrader. Inside the EA, I declare the imported DLL function as:

-----------------------------------------------------------------

#import "MyLib.dll"
void Myfunc(int& value1, int& value2, int& value3);
#import

int a;

int b;

int c;

// call Myfunc to fill in the values for a, b, c.

Myfunc(a, b, c);

--------------------------------------------------------------

I have written the external function "Myfunc" to accept pointers to 3 integers as input parameters and "Myfunc" will then fill in the values into these 3 integers.

Is this possible in MQL4?

Did you solve this already? I have a similar need to have an external dll. Did I understand it right that your need that 8 line code to be recoded to an external script? I have also Myfunc written and need to know how to call that OUTSIDE of MT4.

N.

 

https://docs.mql4.com/basis/preprosessor/import

To pass some integer as reference to dll-function to receive some result from this function use array