This is the mail archive of the
mailing list for the pthreas-win32 project.
Re: Success with pthreads-win32 + gcc/mingw
- To: "Bossom, John" <John.Bossom@Cognos.COM>
- Subject: Re: Success with pthreads-win32 + gcc/mingw
- From: Mumit Khan <firstname.lastname@example.org.EDU>
- Date: Tue, 17 Aug 1999 15:06:14 -0500
- cc: email@example.com
On Tue, 17 Aug 1999, Bossom, John wrote:
> Yikes! DllMainCRTStartup is not the same as DllMain.
> Are you replacing DllMainCRTStartup with the DllMain provided by
I should've pointed out that I *am* using DllMain provided by pthreads,
and not replacing it in any way. In fact, my changes to pthreads are just
a few lines.
What I'm pointing out is that DllMain is *not* the entry point. This is
a common misconception that DllMain is somehow the entry point; in fact,
DllMain is just something called by the entry point (just like main or
WinMain@16 is called by the entry point), which needs to do some magic
beforehand. The Mingw runtime provides DllMainCRTStarutp, the entry point,
and very rarely do you need to change.
Essentially all that needs to be done is to remove the -e DllMain@12
argument, and then the startup calls DllMain@12 correctly and everything
If you provide a DllMain, startup calls that (as is the case here); if you
don't, the library provides a default stub.
> Without the DllMain, thread cleanup and tsd destructors will not happen.
Yes, I know.
> _beginthreadex is responsible for ensuring that the CRT is initialized for
I know. CRTDLL uses beginthread and MSVCRT _beginthreadex, and there are
small, but very important, differences.