C/C++ DLL & MetaTrader

 
Hello,

Could anyone give me an example of how passing an int value by reference to a DLL function?

I have tried the following code:

C++:

main.cpp of MyDll.dll:
#define DLLIMPORT __declspec (dllexport)

...

DLLIMPORT void __stdcall GetIntValue(int &i) {
    i = 10;
}

MQL4:

Library (mydll_lib.mqh):
#import "MyDLL.dll"
 
void GetIntValue(int& i);
Script:
#include <mydll_lib.mqh>
 
int start() {
  int i = 0;
  GetIntValue(i);
  Comment(i);
}

This isn´t works :(

Attention.: The DLL was written with Dev-C++ 4.9.9.2

Thank You!
 
You cannot pass parameters by reference to dll functions. Arrays only.

See https://docs.mql4.com/basis/variables/extfunctions
 
Stringo,

thank you very much.

Regards,

Renato.