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

Commit

Permalink
core/runtime.d: use WCHAR to interface to Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Dec 3, 2018
1 parent 118e298 commit f4abe84
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/core/runtime.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@
* Copyright: Copyright Sean Kelly 2005 - 2009.
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Authors: Sean Kelly
* Source: $(DRUNTIMESRC core/_runtime.d)
* Source: $(LINK2 https://github.com/dlang/druntime/blob/master/src/core/runtime.d, _runtime.d)
* Documentation: https://dlang.org/phobos/core_runtime.html
*/

/* Copyright Sean Kelly 2005 - 2009.
* 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 core.runtime;

version (Windows) import core.stdc.wchar_ : wchar_t;

version (OSX)
version = Darwin;
else version (iOS)
Expand All @@ -27,8 +21,7 @@ else version (WatchOS)

/// C interface for Runtime.loadLibrary
extern (C) void* rt_loadLibrary(const char* name);
/// ditto
version (Windows) extern (C) void* rt_loadLibraryW(const wchar_t* name);

/// C interface for Runtime.unloadLibrary, returns 1/0 instead of bool
extern (C) int rt_unloadLibrary(void* ptr);

Expand Down Expand Up @@ -243,7 +236,7 @@ struct Runtime
if (len == 0)
return null;

auto buf = cast(wchar_t*)malloc((len+1) * wchar_t.sizeof);
auto buf = cast(WCHAR*)malloc((len+1) * WCHAR.sizeof);
if (buf is null) return null;
scope (exit) free(buf);

Expand Down

0 comments on commit f4abe84

Please sign in to comment.