← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2348: re-add 2302 with some tweaking

 

------------------------------------------------------------
revno: 2348
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2010-12-18 17:42:12 +0100
message:
  re-add 2302 with some tweaking
modified:
  SConstruct
  dwt/src/Application.cpp
  win32/main.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'SConstruct'
--- SConstruct	2010-12-16 21:59:31 +0000
+++ SConstruct	2010-12-18 16:42:12 +0000
@@ -172,6 +172,14 @@
 	link_flags = gcc_link_flags
 	defs = gcc_defs
 
+	if env['mode'] == 'debug':
+		import sys
+		if sys.platform == 'win32':
+			env.Append(CCFLAGS = ['-mwindows'])
+			env.Append(LINKFLAGS = ['-mwindows'])
+		else:
+			env.Append(CPPDEFINES = ['CONSOLE'])
+
 	env.Tool("gch", toolpath=".")
 
 	env.Append(CPPPATH = ['#/htmlhelp/preload/', '#/htmlhelp/include/'])

=== modified file 'dwt/src/Application.cpp'
--- dwt/src/Application.cpp	2010-12-16 21:59:31 +0000
+++ dwt/src/Application.cpp	2010-12-18 16:42:12 +0000
@@ -276,7 +276,7 @@
 
 } // namespace dwt
 
-int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
 {
 	unsigned int retVal = 0;
 

=== modified file 'win32/main.cpp'
--- win32/main.cpp	2010-12-16 21:59:31 +0000
+++ win32/main.cpp	2010-12-18 16:42:12 +0000
@@ -70,8 +70,6 @@
 #endif
 
 int SmartWinMain(dwt::Application& app) {
-	dcdebug("StartWinMain\n");
-
 	// http://www.kb.cert.org/vuls/id/707943 part III, "For Developers".
 	::SetDllDirectory(_T(""));
 
@@ -114,9 +112,10 @@
 #ifdef _DEBUG
 	old_handler = set_terminate(&term_handler);
 
-#ifdef __MINGW32__
-	// For debugging
-	::LoadLibrary(_T("exchndl.dll"));
+#ifndef CONSOLE
+	// attach to the parent console, or create one
+	if(AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())
+		freopen("conout$", "w", stdout);
 #endif
 #endif