Problem calling DLL? - 13/12/06 03:10 AM
A 32-bit DLL I've written for mIRC basically wraps some winsock functions and does some simple processing. When I call any function from this DLL, mIRC 6.21 crashes. The code I've posted is enough to cause mIRC 6.21 to crash, by running the dll in such a way: $dll(thefile.dll, init, $null). It appears mIRC doesn't even get the opportunity to call the function, it just crashes. Is this a mIRC bug, or is there something I've done wrong?
Code:
#include <stdlib.h> #include <string.h> #include <stdio.h> #include <winsock.h> #pragma comment(lib, "ws2_32.lib") #define FORMAT "%08p" typedef struct { DWORD mVersion; HWND mHwnd; BOOL mKeep; } LOADINFO; void __declspec(dllexport) LoadDll(LOADINFO *ldinfo); int __declspec(dllexport) init(HWND mWnd, HWND aWnd, char *data, char *params, BOOL show, BOOL nopause); void __declspec(dllexport) LoadDll(LOADINFO *ldinfo) { return; } int __declspec(dllexport) init(HWND mWnd, HWND aWnd, char *data, char *params, BOOL show, BOOL nopause) { WSADATA wsa; sprintf(data, FORMAT FORMAT, WSAStartup(0x10, &wsa), &wsa); return 3; }