MQL4 - automated forex trading   /  

Forum

Calling a DLL from within an EA

Back to topics list To post a new topic, please log in or register

avatar
16
karan 2006.05.30 00:26 
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?



Drawing Horizontal Break-Through Levels Using Fractals

Drawing Horizontal Break-Through Levels Using Fractals

The article describes creation of an indicator that would display the support/resistance levels using up/down fractals.


avatar
Moderator
2824
Tatyana 2006.05.30 11:03 
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.

avatar
Moderator
5198
stringo 2006.05.30 11:38 

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

Can You show exact log message?


avatar
16
karan 2006.05.30 18:44 
stringo wrote:

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.
Back to topics list  

To add comments, please log in or register