MQL4 - automated forex trading   /  

Forum

Error 127 calling a dll function ? Please help.

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

avatar
36
abiank 2007.12.03 15:01 
Hello all (but most importantly Slawa :)

I am trying to use a dll in an EA, but i get the following error when i try to access its first function:

12:51:17 DllTest DAX,H1: loaded successfully
12:52:01 DllTest DAX,H1: cannot call function 'isInitialized' from dll 'test28. dll' (error 127)
12:52:01 DllTest DAX,H1: expert stopped

unfortunately i couldnt find any description of this error 127. Can You help?

Thanks in advance..
article

Interview with Harry Brinkhuis

To my findings a Take Profit of 42 and a Stop Loss of 84 is the right combination for Phoenix. They are part of what I call the balance between settings, timeframe, Stop Loss and Take Profit. Other people that were testing Phoenix tried to change Take Profit and Stop Loss and got very different results. They somehow changed "The Balance"!


avatar
Moderator
5089
stringo 2007.12.03 15:29 

Use search, please. http://forum.mql4.com/search/error%20127

You need to include def-file to your dll-project


avatar
36
abiank 2007.12.03 20:02 
OOps, my bad. thank You!

avatar
36
abiank 2007.12.03 20:46 
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?

LIBRARY dlltest.dll
EXPORTS
bumpStepSizes
createNetwork

is what I am using, should I use decorated names? such as createNetwork@2 etc etc?

Thanks.

avatar
36
abiank 2007.12.04 01:49 
ok i figured it out, me very stupid :)

avatar
4
axmf 2007.12.04 09:03 
Exported functions for MT4 created in Visual must be declared as _stdcall, not as _cdecl, which is the standard-declaration of functions in Visual !

avatar
16
netconuk 2009.07.20 08:07 

I'm having the same problem using VB. I've copied my DLL file over. Do I need anything else?


-Jerry


avatar
4
tm20 2010.02.20 23:30 

Hi Jerry,

If you have created your dll, and not added a DEF file for the function Exports, the names of the functions will be Mangled ... like DoMail() may look like _DoMail@12.

Either add a def file, naming your exports, the file is really simple and looks like the stuff below.

LIBRARY "mqlmail"

EXPORTS

DoMail

TDoSomething

Now you can use the unmangled function names.

If you want to use the mangled names and not add a DEF file you can use the Visual Studio Command Prompt Window with 'dumpbin /exports "MQLMail.dll"' to find the mangled names you have to use in your indicator / expert.

Let me know if this helps,

Thanks

T


avatar
104
7bit 2010.02.21 00:58 
abiank wrote >>
I have created a .def file and put it into experts\libraries,

The .def file is for the linker when building the dll, not for metatrader.


Alternatively you could abandon the use of this ancient C++ entirely and use appropriate and modern language and tools for creating dlls like for example Delphi or FPC/Lazarus. This would save you a lot of headache since everything will be much more intuitive and less error prone.

Back to topics list  

To add comments, please log in or register