[PATCH 1 of 3] exewrapper: report name of failed DLL in error message

Adrian Buehlmann adrian at cadifra.com
Wed Oct 14 10:38:13 UTC 2015


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1444818129 -7200
# Node ID b8bf5a263a32ff73a4da0ba1512c0f1c42b49b88
# Parent  79d86ab65c9def3fdd65ec972bc5fa89688a19ff
exewrapper: report name of failed DLL in error message

This uses C string literal concatenation.

Example output:

  $ hg version
  abort: failed to load Python DLL python27.dll

Note that HGPYTHONLIB does not contain the trailing .dll, which works here
because the dcoumentation of LoadLibrary [1] says, that if no file name
extension is specified in the filename parameter, the default library
extension .dll is appended.

See [2] for a motivation of this change.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx
[2] https://selenic.com/pipermail/mercurial/2015-August/048627.html

diff --git a/mercurial/exewrapper.c b/mercurial/exewrapper.c
--- a/mercurial/exewrapper.c
+++ b/mercurial/exewrapper.c
@@ -106,7 +106,7 @@
 	if (pydll == NULL) {
 		pydll = LoadLibrary(HGPYTHONLIB);
 		if (pydll == NULL) {
-			err = "failed to load Python DLL";
+			err = "failed to load Python DLL " HGPYTHONLIB ".dll";
 			goto bail;
 		}
 	}


More information about the Mercurial-devel mailing list