Index: sendmsg.c =================================================================== RCS file: /cvsroot/gnustep/gnustep/dev-libs/libobjc/sendmsg.c,v retrieving revision 1.4 diff -u -r1.4 sendmsg.c --- sendmsg.c 25 Feb 2003 04:26:51 -0000 1.4 +++ sendmsg.c 11 Aug 2003 21:22:16 -0000 @@ -174,6 +174,22 @@ IMP result; if (receiver) { +#if __GNUC__ < 3 || (__GNUC__ == 3&& __GNUC_MINOR__ < 3) +#define PROTOCOL_VERSION 2 // needs to match what is in init.c + // This is a dirty hack for GCC < 3.3 + // Protocols that are referenced in a module, but not implemented by a + // class declared in that same module never get initialized, so if + // we see the magic number PROTOCOL_VERSION, then the object must be + // a Protocol. It may be just corrupted memory, but in that case + // we are going to crash anyway, so no harm done. + if (receiver->class_pointer == (void*)PROTOCOL_VERSION) { + static Class proto_class = 0; + if (!proto_class) + proto_class = objc_lookup_class ("Protocol"); + if (proto_class) + receiver->class_pointer = proto_class; + } +#endif result = sarray_get_safe (receiver->class_pointer->dtable, (sidx)op->sel_id); if (result == 0) Index: thr-win32.c =================================================================== RCS file: /cvsroot/gnustep/gnustep/dev-libs/libobjc/thr-win32.c,v retrieving revision 1.2 diff -u -r1.2 thr-win32.c --- thr-win32.c 25 Feb 2003 04:26:51 -0000 1.2 +++ thr-win32.c 11 Aug 2003 21:22:17 -0000 @@ -31,6 +31,7 @@ #define __OBJC__ #endif #include +#include /* Key structure for maintaining thread specific storage */ static DWORD __objc_data_tls = (DWORD)-1; @@ -66,10 +67,18 @@ DWORD thread_id = 0; HANDLE win32_handle; +#ifndef __MINGW__ if (!(win32_handle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func, arg, 0, &thread_id))) +#else + unsigned thread_id = 0; + unsigned long win32_handle; + // According to MSDN documentation threads which use libc functions should call _beginthreadex not CreateThread + if (-1 == (win32_handle = _beginthreadex(NULL, 0, (void*)func, arg, 0, &thread_id))) +#endif thread_id = 0; - + + CloseHandle((HANDLE)win32_handle); return (objc_thread_t)thread_id; } @@ -141,7 +150,11 @@ __objc_thread_exit(void) { /* exit the thread */ +#ifndef __MINGW__ ExitThread(__objc_thread_exit_status); +#else + _endthreadex(__objc_thread_exit_status); +#endif /* Failed if we reached here */ return -1;