| / | Forum |
|
marshall318
2008.02.07 04:51
marshall318 wrote: I read some threads about error 127, the possible solution is to put a definition file in the import. but I don't know what a def file looks like.phy wrote:
Does your DLL export the function named Add ?
AddTwo.c, AddTwo.ctf, AddTwo.exports, AddTwo.h, AddTwo_mcc_component_data.c, AddTwo.dll, AddTwo.exp, AddTwo.lib #import "AddTwo.dll" int AddTwo( int a, int b); #import int start() { //---- int x = 5; int y = 10; Print(" 2 + 3 = ", AddTwo( 2, 3)); Print(" x + y = ", AddTwo( x, y)); return(0); } |
|
phy
2008.02.07 05:15
127 sounds familiar, are you sure you have permissions set in your MT4 to allow DLL calls ? 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 |
|
marshall318
2008.02.07 05:50
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. |
|
phy
2008.02.07 06:07
http://forum.mql4.com/9660 "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 |
|
marshall318
2008.02.07 06:16
phy wrote: '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. |
|
phy
2008.02.07 07:53
Try asking your question on the Russian Forum... http://www.mql4.com/ru/search/MATLAB ---- What sort of tool are you making? Curious, now... |
|
marshall318
2008.02.07 15:38
phy wrote: Try asking your question on the Russian Forum... http://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. |
|
jason_sep
2008.02.12 19:30
marshall318 wrote:
phy wrote: Try asking your question on the Russian Forum... http://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.
|
|
mick
2009.08.12 14:31
Hi, has anyone had any luck in resolving the problem of getting error 127 when trying to import dll's made from matlab?
|
|
jjc
2009.08.12 14:37
mick wrote >>
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)' |