summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2014-07-07 11:12:31 +0400
committerIvan Maidanski <ivmai@mail.ru>2014-07-07 11:12:31 +0400
commit6461bd897614e18fa81b04d1080a8872bb4276f9 (patch)
tree267a75b56bd60cc0b5a6684627a308df644c2d16
parent8b0f205d492440bc65405c53a565e1bfab75d380 (diff)
downloadbdwgc-6461bd897614e18fa81b04d1080a8872bb4276f9.tar.gz
New macro (NO_WINMAIN_ENTRY) to prefer main() instead of WinMain (Win32)
* tests/test.c (WinMain): Do not define if NO_WINMAIN_ENTRY (define main() instead). * tests/test_cpp.cc (WinMain): Define (instead of main()) for MSWIN32 and WinCE (but not for MinGW and not if NO_WINMAIN_ENTRY).
-rw-r--r--tests/test.c11
-rw-r--r--tests/test_cpp.cc9
2 files changed, 13 insertions, 7 deletions
diff --git a/tests/test.c b/tests/test.c
index fa2eda17..ea59af70 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -1397,7 +1397,8 @@ void GC_CALLBACK warn_proc(char *msg, GC_word p)
#if !defined(PCR) && !defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) \
|| defined(LINT)
-#if defined(MSWIN32) && !defined(__MINGW32__) || defined(MSWINCE)
+#if (defined(MSWIN32) && !defined(__MINGW32__) || defined(MSWINCE)) \
+ && !defined(NO_WINMAIN_ENTRY)
int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prev,
WINMAIN_LPTSTR cmd, int n)
#elif defined(RTEMS)
@@ -1548,8 +1549,12 @@ DWORD __stdcall thr_window(void *arg)
}
#endif
-int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prev,
- WINMAIN_LPTSTR cmd, int n)
+#if !defined(NO_WINMAIN_ENTRY)
+ int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prev,
+ WINMAIN_LPTSTR cmd, int n)
+#else
+ int main(void)
+#endif
{
# if NTHREADS > 0
HANDLE h[NTHREADS];
diff --git a/tests/test_cpp.cc b/tests/test_cpp.cc
index de01bf71..17673d7a 100644
--- a/tests/test_cpp.cc
+++ b/tests/test_cpp.cc
@@ -187,10 +187,11 @@ GC_word Disguise( void* p ) {
void* Undisguise( GC_word i ) {
return (void*) ~ i;}
-#if 0//def MSWIN32
-int APIENTRY WinMain(
- HINSTANCE instance, HINSTANCE prev, LPSTR cmd, int cmdShow )
-{
+#if (defined(MSWIN32) && !defined(__MINGW32__) || defined(MSWINCE)) \
+ && !defined(NO_WINMAIN_ENTRY)
+ int APIENTRY WinMain( HINSTANCE instance,
+ HINSTANCE prev, LPSTR cmd, int cmdShow )
+ {
int argc;
char* argv[ 3 ];