I am trying to write a simple program in MQL4 which passes a variable to a C++ DLL function by reference and prints the updated variable value in MQL4. Given below is my code.
DLL function:
void Test(int* X)
{
*X = 6;
}
MQL4 Code
#import "Test.dll"
void Test(int&);
#import
void OnStart()
{
int A;
Test(A);
Alert(A);
}
But I am not getting any value back from C++ function for variable A. Can someone please help me what I am doing wrong here?
Thanks in advance
Let's start with the DLL-side:
MQL4 requires DLL to have:
Now demonstrate the MQL4 side:
Anyway, enjoy the Wild Worlds of MQL4 -- Also may enjoy to click and read other posts on issues in MQL4/DLL integration and/or signalling/messaging in MQL4 domains. Feel free to ask more
Finally, MQL4 Documentation states: