Mail Archives: cygwin/2001/07/17/20:05:53
On Tue, Jul 17, 2001 at 04:11:55PM -0500, Mumit Khan wrote:
> On Tue, 17 Jul 2001, Christopher Faylor wrote:
>
> > On Tue, Jul 17, 2001 at 12:59:46PM -0700, Mo DeJong wrote:
> > >I am trying to figure out how to create a .dll that depends on
> > >cygwin1.dll and msvcrt.dll. Here is the link time error I am currently
> > >seeing:
> >
> > You can't do that. You can't mix two different runtime systems
> > they are mutually exclusive.
>
>
> In this particular case however, you need to replace _beginthreadex and
> _endthreadex with Windows32 API "equivalents" -- Create/EndThread. Here's
> the bit from my local tree, based on tcl 8.3. Caveat noted in the source.
>
> 2000-02-22 Mumit Khan <khan AT xraylith DOT wisc DOT edu>
>
> * win/tclWinThrd.c (TclpThreadCreate): Conditionalize on
> TCL_THREADS. Add workaround for lack of _beginthreadex under
> CRTDLL runtime.
> (TclpThreadExit): Likewise.
>
> Index: win/tclWinThrd.c
> ===================================================================
> RCS file: /homes/khan/src/CVSROOT/tcl8.3.0/win/tclWinThrd.c,v
> retrieving revision 1.1.1.1
> retrieving revision 1.3
> diff -u -3 -p -r1.1.1.1 -r1.3
> --- win/tclWinThrd.c 2000/02/16 21:47:46 1.1.1.1
> +++ win/tclWinThrd.c 2000/02/22 04:15:06 1.3
> @@ -120,15 +120,31 @@ TclpThreadCreate(idPtr, proc, clientData
> Tcl_ThreadCreateProc proc; /* Main() function of the thread */
> ClientData clientData; /* The one argument to Main() */
> {
> +#ifdef TCL_THREADS
> unsigned long code;
>
> +#if !defined(__GNUC__) || (defined(__GNUC__) && defined(__MSVCRT__))
> code = _beginthreadex(NULL, 0, (LPTHREAD_START_ROUTINE) proc,
> (void *)clientData, 0, (unsigned *)idPtr);
> +#else
> + /*
> + * MS CRTDLL runtime, one of two supported GCC/Mingw, does not support
> + * the _beginthreadex and endthreadex interfaces, and we resort to using
> + * Win32 API CreateThread and ExitThread interfaces instead. A side
> + * effect is that there is a potential resource leak after each thread
> + * exits.
> + */
> + code = (unsigned long) CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) proc,
> + (DWORD *)clientData, 0, (DWORD *)idPtr);
I'm somehow missing a
CloseHandle ((HANDLE)code);
at this point which at least closes the handle to the thread. Otherwise
the following from MSDN is valid:
The thread object remains in the system until the thread has
terminated and all handles to it have been closed through a
call to CloseHandle.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin AT cygwin DOT com
Red Hat, Inc.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -