diff options
author | Simon Krauter <trustablecode@gmail.com> | 2018-03-06 11:58:43 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-03-06 11:58:43 +0100 |
commit | 077ff83b6e27dad47c654f6d732fb03618f07748 (patch) | |
tree | 02ae887a848c1ef7351ede32c10c9cc1a87c53dc /lib/system | |
parent | a9974a33f10e380c1277d3cda296b7012033b2e5 (diff) | |
download | Nim-077ff83b6e27dad47c654f6d732fb03618f07748.tar.gz |
Fixes #7212, now with better code (#7302)
When platform is Windows and app type is GUI, an error about missing DLL file is displayed as message box in addition to the console output, which is usually not visible.
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/dyncalls.nim | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/system/dyncalls.nim b/lib/system/dyncalls.nim index c8e251d1e..f1ff307da 100644 --- a/lib/system/dyncalls.nim +++ b/lib/system/dyncalls.nim @@ -31,6 +31,13 @@ proc nimLoadLibraryError(path: string) = stderr.rawWrite("\n") when not defined(nimDebugDlOpen) and not defined(windows): stderr.rawWrite("compile with -d:nimDebugDlOpen for more information\n") + when defined(windows) and defined(guiapp): + # Because console output is not shown in GUI apps, display error as message box: + const prefix = "could not load: " + var msg: array[1000, char] + copyMem(msg[0].addr, prefix.cstring, prefix.len) + copyMem(msg[prefix.len].addr, path.cstring, min(path.len + 1, 1000 - prefix.len)) + discard MessageBoxA(0, msg[0].addr, nil, 0) quit(1) proc procAddrError(name: cstring) {.noinline.} = |