Calling a DLL from within an EA

To add comments, please log in or register
karan
52
karan  
I am trying to call a DLL from an EA.

I am getting an error message in the EA log that I am unable to call the function in the DLL. I thought it might be a parmeter passing issue so I made a dummy function with no params:

int getInt();


In the DLL this is defined as

__declspec(dllexport) int __stdcall getInt() { return 1; }


i am also enabling Expert Advisors and no confirmation of DLL calls.


Can anyone tell me what I am doing wrong or point me to a possible solution?
Tatyana
101
Tatyana  
All functions exported from DLLs have to be described as 'stdcall' (in C-language notation) in order MetaTrader to be able to call them correctly. The Terminal uses only the 'stdcall' appearance.
Slava
Moderator
13392
Slava  

What is "unable to call the function in the DLL"?

Can You show exact log message?

karan
52
karan  
stringo:

What is "unable to call the function in the DLL"?

Can You show exact log message?

Thanks. I was able to fix the problem. I had started with a DLL created using the .NET 2005 (unmanged code in C++). Apparemtly there are some settings for the project files that are not compatible with MQL. I did not figure out what they were. Instead, I started with the ExpertSample project file and placed my code in it and modified the file names. This seems to have done the trick and things are working now.
To add comments, please log in or register