Current druntime's master doesn't work well to use Runtime.loadLibrary:
------------------------------------
void main()
{
import core.runtime;
// import\core\runtime.d(250): Error: undefined identifier rt_loadLibraryW,
// did you mean function rt_loadLibrary?
// Error: template instance `core.runtime.Runtime.loadLibrary!()`
// error instantiating
auto kernel32 = Runtime.loadLibrary("kernel32.dll"):
scope (exit) Runtime.unloadLibrary(kernel32);
}
------------------------------------
Probably it is caused by the following commit:
https://github.com/dlang/druntime/commit/f4abe84945e75889dea15cd61d6eb27c83e7b56d
Comment #1 by bugzilla — 2018-12-19T20:36:50Z
wchar_t should not be used in D code unless it is directly interfacing with C++ code that uses wchar_t in its parameter list.
The bug here is that core\druntime.d is calling a D function rt_loadLibraryW() which is obsoletely using wchar_t in its signature.
The fix is to use WCHAR instead and fix rt\dmain2.d to use WCHAR.
Comment #2 by bugzilla — 2018-12-19T20:44:10Z
The files in question:
rt\dmain2.d
core\runtime.d
There's no reason to ever use the "A" Windows functions anymore, as Windows 95 is long dead.
1. delete rt_loadLibraryW()
2. move the logic in loadLibrary() to rt_loadLibrary()