From: colin AT bird DOT fu DOT is DOT saga-u DOT ac DOT jp (Colin Peters) Subject: Re: _beginthread Problems with win95 and mingw32 using C++ 5 Dec 1997 07:08:21 -0800 Message-ID: <01bd0141$5f8510a0$fa173185.cygnus.gnu-win32@gbird0.fu.is.saga-u.ac.jp> Reply-To: "Colin Peters" Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit To: "John Miller" Cc: "GNU-Win32" From: John Miller To: gnu-win32 AT cygnus DOT com Date: Friday, December 05, 1997 2:25 PM Subject: _beginthread Problems with win95 and mingw32 using C++ >I was able to solve the error below by >commenting out the "__attribute__((__cdecl__))" portion, but then when I >attempt to use the _beginthread() finction I get an ld message that says >"undefined reference to _beginthread()" ld fatal signal 1" this also >doesn't happen in "C". Please help. The reason the function doesn't work without __cdecl__ is that it is getting name mangled like a C++ function (I think, see below). The header file should feature a pair of sequences like this around the _beginthread and other prototypes: #ifdef __cplusplus extern "C" { #endif .... function prototypes ... #ifdef __cplusplus } #endif The version of Mingw32 you are using might have a bug in that header. You could try downloading version 0.1.4 from my web page, or the latest snapshot if you feel brave (on second thought, if you download the latest snapshot only pull out the process.h header file, the new specs won't work with b18). Now that it occurs to me, what does that prototype look like? It should be unsigned long _beginthread (void (*pfuncStart)(void *), unsigned unStackSize, void* pArgList); It occurs to me that older versions of Mingw32 might have had an attempt to cdecl pfuncStart, which is unnecessary and may cause problems in some cases. Grab process.h out of 0.1.4 (I think) or the latest snapshot. Or just replace the prototype with the one given above. If none of this fixes things it might be a bug in the C++ parser (I doubt it though). It works fine for me using Mumit Khan's Mingw32-native version of EGCS. I can't test against b18 right now (since it isn't on my disk drive). Good luck, Colin. -- Colin Peters -- colin at fu.is.saga-u.ac.jp -- Saga University Dept. of Information Science -- http://www.fu.is.saga-u.ac.jp/~colin -- http://www.geocities.com/Tokyo/Towers/6162 - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".