From: Mumit Khan <khan@NanoTech.Wisc.EDU>
To: cygwin@cygwin.com
Subject: Re: Linking to cygwin1.dll and msvcrt.dll ?
Date: Tue, 17 Jul 2001 14:12:00 -0000 [thread overview]
Message-ID: <Pine.HPP.3.96.1010717160558.9202A-100000@hp2.xraylith.wisc.edu> (raw)
In-Reply-To: <20010717160220.A11104@redhat.com>
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@xraylith.wisc.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);
+#endif
if (code == 0) {
return TCL_ERROR;
} else {
return TCL_OK;
}
+#else
+ return TCL_ERROR;
+#endif
}
\f
/*
@@ -151,7 +167,13 @@ void
TclpThreadExit(status)
int status;
{
+#ifdef TCL_THREADS
+#if !defined(__GNUC__) || (defined(__GNUC__) && defined(__MSVCRT__))
_endthreadex((DWORD)status);
+#else
+ ExitThread((DWORD)status);
+#endif
+#endif
}
\f
Regards,
Mumit
--
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/
next prev parent reply other threads:[~2001-07-17 14:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-17 12:59 Mo DeJong
2001-07-17 13:02 ` Christopher Faylor
2001-07-17 14:12 ` Mumit Khan [this message]
2001-07-17 15:04 ` Corinna Vinschen
2001-07-17 16:01 ` Mo DeJong
2001-07-18 1:46 ` Corinna Vinschen
2001-07-19 16:13 ` Mo DeJong
2001-07-20 10:09 ` Mumit Khan
2001-07-21 14:26 ` Mo DeJong
2001-07-21 15:02 ` Spaces in User Name Dave BT
2001-07-21 17:07 ` Linking to cygwin1.dll and msvcrt.dll ? Robert Collins
2001-07-21 20:31 ` Trevor Forbes
2001-07-21 21:24 ` Christopher Faylor
2001-07-22 5:45 ` Robert Collins
2001-07-17 13:36 Steve Jorgensen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.HPP.3.96.1010717160558.9202A-100000@hp2.xraylith.wisc.edu \
--to=khan@nanotech.wisc.edu \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).