Bug 19498 – undefined identifier rt_loadLibraryW

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2018-12-17T12:49:29Z
Last change time
2019-01-02T03:47:46Z
Assigned to
Eduard Staniloiu
Creator
SHOO

Comments

Comment #0 by zan77137 — 2018-12-17T12:49:29Z
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()
Comment #3 by edi33416 — 2018-12-20T15:33:49Z
Comment #4 by greeenify — 2018-12-30T14:04:11Z
Rainer's PR has been merged.
Comment #5 by github-bugzilla — 2019-01-02T03:47:46Z
Commits pushed to master at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/9f504a4f52e1442fd9497daefee83f61b378a817 fix issue 19498 - undefined identifier rt_loadLibraryW restore definition to avoid breaking change for now https://github.com/dlang/druntime/commit/c54593d256475b6c421b01bdfff958808ecadbaf Merge pull request #2425 from rainers/issue19498 fix issue 19498 - undefined identifier rt_loadLibraryW merged-on-behalf-of: Nicholas Wilson <[email protected]>