DLL threading bug - 05/08/06 01:42 AM
For e.g, take this dll function
and here's the thread:
now if I do something like:
$dllcall(test.dll, 0, Test_Function, hello!) - this works fine. it echos 'hello!' as expected.
BUT, if i call the function multiple times, it gives mIRC errors, E.g.
The dll should make mIRC echo 1,2,3,4,5 (5 times).., but instead i keep get this:
edit* and now i get same problem but it says stack error:
Code:
int WINAPI Test_Function(HWND, HWND, char *data, char *parms, BOOL, BOOL) { CreateThread(NULL, 0, Test_Thread, data, 0, 0); return 1; }
and here's the thread:
Code:
DWORD WINAPI Test_Thread(LPVOID param) { char r[1024]; strcpy(r, "/echo -a "); char *data = (char*) param; strcat(r, data); sendmirc(mapHWND, r); return 1; }
now if I do something like:
$dllcall(test.dll, 0, Test_Function, hello!) - this works fine. it echos 'hello!' as expected.
BUT, if i call the function multiple times, it gives mIRC errors, E.g.
Code:
alias test2 { var %x 1 while (%x <= 5) { $Dllcall(test.dll, 0, Test_Function, %x) inc %x } }
The dll should make mIRC echo 1,2,3,4,5 (5 times).., but instead i keep get this:
edit* and now i get same problem but it says stack error: