We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3844 - Significance of !HAVE_LIBC dependency in Win32 thread function
Summary: Significance of !HAVE_LIBC dependency in Win32 thread function
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: thread (show other bugs)
Version: HG 2.1
Hardware: All Windows (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-24 08:40 UTC by Ozkan Sezer
Modified: 2020-06-21 19:20 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ozkan Sezer 2017-09-24 08:40:10 UTC
I first asked this at https://discourse.libsdl.org/t/23037 and
got no response, so adding here at bugzilla so that it doesn't
get lost:

What is the significance of !HAVE_LIBC dependency in the Win32
thread function? (e.g. see SDL_thread.h)  Because HAVE_LIBC is
a curious thing:  You can have a libc, but you can statically
link SDL to it, e.g. with MSVC or Watcom. Besides, there is no
guarantee that SDL and the client application are linked to the
very same libc, either.

So: is there an actual harm if HAVE_LIBC==1 and SDL still uses
SDL_PASSED_BEGINTHREAD_ENDTHREAD mechanism?  If not, I suggest
the following: comments?

diff --git a/include/SDL_thread.h b/include/SDL_thread.h
--- a/include/SDL_thread.h
+++ b/include/SDL_thread.h
@@ -68,7 +68,7 @@
  */
 typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
 
-#if defined(__WIN32__) && !defined(HAVE_LIBC)
+#if defined(__WIN32__)
 /**
  *  \file SDL_thread.h
  *
Comment 1 Ozkan Sezer 2017-09-24 15:40:15 UTC
Forgot the part that SDL_dynapi_procs.h would need patching
the same way of course, like below.

diff --git a/include/SDL_thread.h b/include/SDL_thread.h
--- a/include/SDL_thread.h
+++ b/include/SDL_thread.h
@@ -68,7 +68,7 @@
  */
 typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
 
-#if defined(__WIN32__) && !defined(HAVE_LIBC)
+#if defined(__WIN32__)
 /**
  *  \file SDL_thread.h
  *
diff --git  a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -48,7 +48,7 @@
 #undef SDL_CreateThread
 #endif
 
-#if defined(__WIN32__) && !defined(HAVE_LIBC)
+#if defined(__WIN32__)
 SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return)
 #elif defined(__OS2__)
 SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return)
Comment 2 Ozkan Sezer 2019-08-25 21:15:42 UTC
Also see bug #4771
Comment 3 Ozkan Sezer 2020-06-21 19:20:01 UTC
Closing this as fixed (see bug #4771).