Hello,
I'm preparing to call a DLL within MT4 and I've come across one construct which I can't get to work.
The original C++ code is here:
I've converted it to this code:
but when I compile I'm getting these errors:
Any suggestions please?
Ensure that the data types and calling conventions match what MQL4 supports. Unlike C++, MQL4 has some limitations regarding function parameter types, especially when it comes to pointers. MT4 does not directly support passing function pointers or raw pointers as function parameters.
Void > int or long or custom structure
MQL4 cannot directly handle function pointers ( TrialCallbackType ), as it doesn't support passing function references from MQL4 to a DLL, you cannot directly pass a function pointer ( TrialCallbackType callback ), you will need to handle the callback within the DLL itself. Set up a static function inside the DLL that is called when necessary. You can convert the void * parameter to an int or long type, and inside the DLL, you can reinterpret it to the actual pointer type. MQL4 can work with integers ( int or long ), and the DLL should convert these back to the appropriate pointer type.
Correct me if im wrong
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I'm preparing to call a DLL within MT4 and I've come across one construct which I can't get to work.
The original C++ code is here:
I've converted it to this code:
but when I compile I'm getting these errors:
Any suggestions please?