From 688cafc19b5d9e5dfb25b2ffe2acdbe9bb4fe314 Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Sat, 6 Oct 2012 18:11:46 -0700 Subject: [PATCH] more Win64 stuff --- src/rt/dmain2.d | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/rt/dmain2.d b/src/rt/dmain2.d index f7f44f7a676..4d1dd031dfb 100644 --- a/src/rt/dmain2.d +++ b/src/rt/dmain2.d @@ -1,16 +1,14 @@ /** * Contains main program entry point and support routines. * - * Copyright: Copyright Digital Mars 2000 - 2010. - * License: Boost License 1.0. + * Copyright: Copyright Digital Mars 2000 - 2012. + * License: Distributed under the + * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). + * (See accompanying file LICENSE) * Authors: Walter Bright, Sean Kelly + * Source: $(DRUNTIMESRC src/rt/_dmain2.d) */ -/* Copyright Digital Mars 2000 - 2010. - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ module rt.dmain2; private @@ -28,16 +26,19 @@ version (Windows) { private import core.stdc.wchar_; - extern (Windows) alias int function() FARPROC; - extern (Windows) FARPROC GetProcAddress(void*, in char*); - extern (Windows) void* LoadLibraryW(in wchar_t*); - extern (Windows) int FreeLibrary(void*); - extern (Windows) void* LocalFree(void*); - extern (Windows) wchar_t* GetCommandLineW(); - extern (Windows) wchar_t** CommandLineToArgvW(wchar_t*, int*); - extern (Windows) export int WideCharToMultiByte(uint, uint, wchar_t*, int, char*, int, char*, int*); - extern (Windows) export int MultiByteToWideChar(uint, uint, in char*, int, wchar_t*, int); - extern (Windows) int IsDebuggerPresent(); + extern (Windows) + { + alias int function() FARPROC; + FARPROC GetProcAddress(void*, in char*); + void* LoadLibraryW(in wchar_t*); + int FreeLibrary(void*); + void* LocalFree(void*); + wchar_t* GetCommandLineW(); + wchar_t** CommandLineToArgvW(wchar_t*, int*); + export int WideCharToMultiByte(uint, uint, wchar_t*, int, char*, int, char*, int*); + export int MultiByteToWideChar(uint, uint, in char*, int, wchar_t*, int); + int IsDebuggerPresent(); + } pragma(lib, "shell32.lib"); // needed for CommandLineToArgvW } @@ -375,6 +376,14 @@ extern (C) int main(int argc, char** argv) } } + version (Win64) + { + auto fp = __iob_func(); + stdin = &fp[0]; + stdout = &fp[1]; + stderr = &fp[2]; + } + _STI_monitor_staticctor(); _STI_critical_init();