Trying to debug dll

 

I'm trying to debug a dll through VS. When I set the exe to metatrader's terminal.exe, it tells me "A debugger has been found running in your system....". When I try to attach to an already running instance of the terminal, it crashes. A google search suggests MT4 builds try to prevent decompilation of the terminal program, but how are we supposed to debug our dlls?

MT4 build 451. Windows server 2008 r2. visual studio 2012.

EDIT:

Resolved by installing and using an older version of MT4 (build 409). Where there's a will, there's a way... ;)

 
There is no real way of debugging a dll when being used in MT4. I have tried it a lot but the best way is to use logging statements in the dll code.
 
Use DebugView. Both Mql and DLL logs combined.
/** Log
* send information to OutputDebugString() to be viewed and logged by
* SysInternal's DebugView (free download from microsoft) This is ideal for
* debugging as an alternative to Print(). The function will take up to 10
* stringa (or numeric) arguments to be concatenated into one debug message.
//*/
#import "kernel32.dll"
   void OutputDebugStringA(string msg);
#import
void Log(string s1,    string s2="", string s3="", string s4="", string s5="",
         string s6="", string s7="", string s8="", string s9="", string s10=""){
    if (IsDllsAllowed()){
        string out  = WindowExpertName() + ": "
                    + s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
        OutputDebugStringA(out);
    }
}