Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
more Win64 stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Oct 7, 2012
1 parent 2b56c55 commit 688cafc
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions src/rt/dmain2.d
@@ -1,16 +1,14 @@
/**
* Contains main program entry point and support routines.
*
* Copyright: Copyright Digital Mars 2000 - 2010.
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* 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
Expand All @@ -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
}

Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 688cafc

Please sign in to comment.