How do you debug a MT4 DLL?

 

I recently had to debug a C++ DLL for an MT4 EA, but MT4 crashes whenever I attach the VC++ debugger to the termimal.exe process. This seems to be due to some crude mechanism in MT4 to prevent reverse engineering. But it's my own DLL that I want to debug.

Has someone else run into the same problem? Is there a safe method to debug DLL functions called from an EA, or do I have to write some MT4 simulator for that purpose?

 

Unfortunately you can not use debugger when runing MT4 (or MT5) terminal. They are trying to hide the communications details that way.

So the only way is a "crude" way - using return values from your DLL. If you need multiple return values, pass some array (fixed size array of doubles) by reference to your DLL and you will be able to see what is your DLL doing on points you need to check

jcl365:
I recently had to debug a C++ DLL for an MT4 EA, but MT4 crashes whenever I attach the VC++ debugger to the termimal.exe process. This seems to be due to some crude mechanism in MT4 to prevent reverse engineering. But it's my own DLL that I want to debug. Has someone else run into the same problem? Is there a safe method to debug DLL functions called from an EA, or do I have to write some MT4 simulator for that purpose?
 

Thanks! Well, I guess I'll have to do that. Back to the debugging methods of the 1970s...

 
jcl365:
Thanks! Well, I guess I'll have to do that. Back to the debugging methods of the 1970s...

The paranoia of metatrader forces us to do so