mIRC Home    About    Download    Register    News    Help

Print Thread
#205052 10/10/08 08:45 PM
Joined: Jan 2007
Posts: 20
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jan 2007
Posts: 20
I'm wondering if it's possible for mIRC to run a DLL that does a system() call. I made one, but after the command has run, even with "debugging" in the form of MessageBox, when the DLL finishes and returns a 3, mIRC crashes. The Dr. Watson crash log doesn't show me where the crash happens, even though the DLL is compiled with debugging. I'm compiling the DLL using MinGW's gcc (specifically g++, as it's a DLL done in C++). I have written other DLLs for mIRC that function just fine, but none of them use system() calls, so I'm not sure if it's this or not. I did notice that mIRC will also crash if LoadDll has a MessageBox call in it, so is it also possible that if a DLL takes too long to do something, it'll crash mIRC?

EDIT:

I tried to compile the DLL under Visual C++ .NET 2003, and used it's debugging to find that it gets done with the DLL fine, but crashes immediately after the DLL has returned. Removing the system() call still causes it to crash, so I retract that it might be that. I have used DLLs made in C++ with mIRC, so I'm not even sure what's the cause now... I'll look into seeing what's causing it.

EDIT 2:

This is even stranger still. I removed ALL the code except for a single "return 3;" in the function being called by mIRC, and it STILL crashes. I'm not even sure how a DLL with nothing but a return can cause mIRC to crash...

FINAL EDIT:

I think this is a false alarm now. It's odd, but adding __stdcall before the variable name worked, which is odd since I haven't added that to any of my other DLLs. So it kinda stumped me as to why I had to do it.

Last edited by CyberBotX; 10/10/08 10:34 PM.
CyberBotX #205058 11/10/08 04:22 AM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
This is definitely a compiler issue... mingw and visualstudio handle calling conventions differently, and you may have toggled a switch in either by compiling it as C++ when it shouldve been C or vice versa.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
argv0 #205067 11/10/08 03:40 PM
Joined: Jan 2007
Posts: 20
C
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Jan 2007
Posts: 20
I actually realized what i did wrong, and it wasn't an issue between either compiler. I needed to have either __stdcall or WINAPI before the function name, and I guess in my haste, I glossed right over that. But it's all working now.


Link Copied to Clipboard