You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Does your DLL export the function named Add ?
I renamed the function from 'Add' to 'AddTwo', I still got the error 127. The following are the files generated from Matlab mcc command:
AddTwo.c, AddTwo.ctf, AddTwo.exports, AddTwo.h, AddTwo_mcc_component_data.c, AddTwo.dll, AddTwo.exp, AddTwo.lib
Def file in C++ looks like this. See the /experts/samples for a def file
Library is the dll name, exports are the names of the functions MT4 will call
--- def file below -----
LIBRARY AddTwo
EXPORTS AddTwo
The setting is right: call of dll is permitted.
Could you pls read the thread: 'Error 127 calling a dll function ? Please help.', they came up with a solution for error 127, but I do not understand how they solved it. def file and _stdcall ? What is it like in MQL4 coding?
Thanks a lot.
"Exported functions for MT4 created in Visual must be declared as _stdcall, not as _cdecl, which is the standard-declaration of functions in Visual !"
This is in the source code for the DLL, specifying something about the calling conventions for MT4 to "call" the function in the DLL They are standard calls and not Microsoft proprietary calls.
"I have created a .def file and put it into experts\libraries, but the problem persists. what am i doing wrong? should I put it somewhere else? or is the format wrong?"
The def file is used by the linker during compilation of the DLL. I don't know the details, but it tells the linker? compiler? DLL code? what functions will be available for calling.
---
You are using MatLab, I have no idea about the detail of that software. Maybe someone else does. My experience is with C++. But MT4 needs "proper" DLL to work with.
Summarizing, the calls into the DLL must be "standard calls" not "decorated" in some Microsoft way, the DLL needs to explicitly be told about the exported functions -- the DEF file, the DLL has to be in a folder accessible by MT4, and MT4 is limited in the data types it can receive from the DLL
'Error 127 calling a dll function ? Please help.'
"Exported functions for MT4 created in Visual must be declared as _stdcall, not as _cdecl, which is the standard-declaration of functions in Visual !"
This is in the source code for the DLL, specifying something about the calling conventions for MT4 to "call" the function in the DLL They are standard calls and not Microsoft proprietary calls.
"I have created a .def file and put it into experts\libraries, but the problem persists. what am i doing wrong? should I put it somewhere else? or is the format wrong?"
The def file is used by the linker during compilation of the DLL. I don't know the details, but it tells the linker? compiler? DLL code? what functions will be available for calling.
---
You are using MatLab, I have no idea about the detail of that software. Maybe someone else does. My experience is with C++. But MT4 needs "proper" DLL to work with.
Summarizing, the calls into the DLL must be "standard calls" not "decorated" in some Microsoft way, the DLL needs to explicitly be told about the exported functions -- the DEF file, the DLL has to be in a folder accessible by MT4, and MT4 is limited in the data types it can receive from the DLL
I guess I have to find someone with Matlab experience. Thank you very much.
https://www.mql4.com/ru/search/MATLAB
----
What sort of tool are you making? Curious, now...
Try asking your question on the Russian Forum...
https://www.mql4.com/ru/search/MATLAB
----
What sort of tool are you making? Curious, now...
I am building NNs to predict future trend like what Better did in the Championship. Have you got a money-making EA now? If not, try to make one for yourself. It won't be very difficult for you. Good luck! Thanks again for your help.
Try asking your question on the Russian Forum...
https://www.mql4.com/ru/search/MATLAB
----
What sort of tool are you making? Curious, now...
I am building NNs to predict future trend like what Better did in the Championship. Have you got a money-making EA now? If not, try to make one for yourself. It won't be very difficult for you. Good luck! Thanks again for your help.
Hi,
Have you had any luck getting this working? I am getting the same error.
Hi, has anyone had any luck in resolving the problem of getting error 127 when trying to import dll's made from matlab?
Not tried it myself, but one of the sticky topics at the top of the forum seems to be on this subject: 'New article: Interaction between MеtaTrader 4 and MATLAB Engine (Virtual MATLAB Machine)'