This is the mail archive of the
mailing list for the Cygwin project.
Re: Linking to cygwin1.dll and msvcrt.dll ?
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 <email@example.com>
> * 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 188.8.131.52
> retrieving revision 1.3
> diff -u -3 -p -r184.108.40.206 -r1.3
> --- win/tclWinThrd.c 2000/02/16 21:47:46 220.127.116.11
> +++ 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);
> + /*
> + * 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
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 Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:firstname.lastname@example.org
Red Hat, Inc.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html