From c166c6beabad82bfd0fe2e7b5fed4ae5019a723c Mon Sep 17 00:00:00 2001 From: "Eric J. Korpela" Date: Thu, 1 Dec 2005 00:25:21 +0000 Subject: [PATCH] Minor mods to allow BOINC apps to be compiled under Windows using Dev-C++ with MinGW svn path=/trunk/boinc/; revision=9013 --- api/boinc_gl.h | 4 ++++ api/graphics_lib.C | 12 ++++-------- api/gutil.h | 2 +- lib/boinc_win.h | 13 +++++++++++-- lib/diagnostics.C | 4 +++- lib/diagnostics.h | 6 ++++++ lib/stackwalker_win.h | 1 + lib/util.C | 3 +++ sched/Makefile.am | 4 ++-- 9 files changed, 35 insertions(+), 14 deletions(-) diff --git a/api/boinc_gl.h b/api/boinc_gl.h index b61678aa95..52987bc7ba 100644 --- a/api/boinc_gl.h +++ b/api/boinc_gl.h @@ -24,7 +24,11 @@ #if defined(_WIN32) # include # include +#ifndef __MINGW32__ # include +#else +# include +#endif # include #elif defined(__APPLE_CC__) diff --git a/api/graphics_lib.C b/api/graphics_lib.C index d02b7cb857..5d77d80eae 100644 --- a/api/graphics_lib.C +++ b/api/graphics_lib.C @@ -70,15 +70,9 @@ int boinc_init_options_graphics_lib( boinc_main_state.set_worker_timer_hook = set_worker_timer; boinc_main_state.app_client_shmp = &app_client_shm; - // figure out name of executable, and append .so - // - if ((ptr = strrchr(argv0, '/'))) { - ptr++; - } else { - ptr = argv0; - } + ptr = argv0; strcpy(graphics_lib, ptr); - strncat(graphics_lib, ".so", BOINC_STRLEN); + strncat(graphics_lib, DLLEXT, BOINC_STRLEN); graphics_lib[BOINC_STRLEN-1] = 0; // boinc-resolve library name: it could be a XML symlink @@ -88,6 +82,7 @@ int boinc_init_options_graphics_lib( "Unable to boinc_resolve name of shared object file %s\n", graphics_lib ); + fflush(stderr); goto no_graphics; } @@ -102,6 +97,7 @@ int boinc_init_options_graphics_lib( fprintf(stderr, "dlopen() failed: %s\nNo graphics.\n", errormsg?errormsg:"" ); + fflush(stderr); goto no_graphics; } diff --git a/api/gutil.h b/api/gutil.h index b0249877d2..98990c23e6 100755 --- a/api/gutil.h +++ b/api/gutil.h @@ -203,7 +203,7 @@ public: #define ALIGN_CENTER 1 #define ALIGN_TOP 2 -extern unsigned int* read_rgb_texture (const char *, int*, int* ,int *); +unsigned int* read_rgb_texture (const char *, int*, int* ,int *); struct TEXTURE_DESC { bool present; diff --git a/lib/boinc_win.h b/lib/boinc_win.h index 31954fb4c2..2e58b808cb 100644 --- a/lib/boinc_win.h +++ b/lib/boinc_win.h @@ -61,16 +61,25 @@ #include #include #include +#ifdef __MINGW32__ +#include +#endif + #include #include #include #include #include +#ifndef __MINGW32__ #include +#endif #include +#ifndef __MINGW32__ #include +#endif +#ifndef __MINGW32__ #include - +#endif // All projects should be using std::min and std::max instead of the Windows // version of the symbols. #undef min @@ -91,8 +100,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/lib/diagnostics.C b/lib/diagnostics.C index c9565dcc82..36ad82b7a5 100644 --- a/lib/diagnostics.C +++ b/lib/diagnostics.C @@ -32,7 +32,7 @@ #include "config.h" #endif -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) #include "stackwalker_win.h" #endif @@ -374,9 +374,11 @@ LONG CALLBACK boinc_catch_signal(EXCEPTION_POINTERS *pExPtrs) { } fflush( stderr ); +#ifndef __MINGW32__ // Unwind the stack and spew it to stderr if (flags & BOINC_DIAG_DUMPCALLSTACKENABLED ) StackwalkFilter( pExPtrs, EXCEPTION_EXECUTE_HANDLER, NULL ); +#endif fprintf( stderr, "Exiting...\n" ); fflush( stderr ); diff --git a/lib/diagnostics.h b/lib/diagnostics.h index 38160c6cee..1e3ff6fa90 100644 --- a/lib/diagnostics.h +++ b/lib/diagnostics.h @@ -129,9 +129,15 @@ extern void boinc_info_release(const char *pszFormat, ...); #else // _DEBUG +#ifdef __MINGW32__ +#define BOINCASSERT(expr) +#define BOINCTRACE(...) +#define BOINCINFO boinc_info_release +#else // __MINGW32__ #define BOINCASSERT(expr) __noop #define BOINCTRACE __noop #define BOINCINFO boinc_info_release +#endif // __MINGW32__ #endif // _DEBUG diff --git a/lib/stackwalker_win.h b/lib/stackwalker_win.h index 3047d9f970..fc2de8d477 100644 --- a/lib/stackwalker_win.h +++ b/lib/stackwalker_win.h @@ -22,6 +22,7 @@ #ifndef __STACKWALKER_H__ #define __STACKWALKER_H__ +#include "boinc_win.h" // Only valid in the following environment: Intel platform, MS VC++ 5/6/7 #ifndef _X86_ #error Only INTEL envirnoments are supported! diff --git a/lib/util.C b/lib/util.C index 86b30dca6a..a6a2d348af 100755 --- a/lib/util.C +++ b/lib/util.C @@ -40,7 +40,9 @@ #include #include #include +#ifdef HAVE_SYS_TIME_H #include +#endif #include #include #ifdef HAVE_SYS_FILE_H @@ -48,6 +50,7 @@ #endif #endif + #include "error_numbers.h" #include "filesys.h" #include "util.h" diff --git a/sched/Makefile.am b/sched/Makefile.am index d12ffb5134..b0a36f2a87 100644 --- a/sched/Makefile.am +++ b/sched/Makefile.am @@ -194,7 +194,7 @@ fcgi_LDADD = $(LDADD) $(RSA_LIBS) -lfcgi $(MYSQL_LIBS) .PHONY: PHONY-start PHONY-start: - @test -f start || ln -s $(srcdir)/start start && test -f start + @test -f start || @LN_S@ $(srcdir)/start start && test -f start status stop: PHONY-start - @test -f $@ || ln -s start $@ && test -f $@ + @test -f $@ || @LN_S@ start $@ && test -f $@