summaryrefslogtreecommitdiffstats
path: root/src/mspdb.cpp
diff options
context:
space:
mode:
authorRainer Schuetze <r.sagitario@gmx.de>2020-03-09 07:04:29 (GMT)
committerRainer Schuetze <r.sagitario@gmx.de>2020-03-09 07:04:29 (GMT)
commit191f0a0b1131e5d095637a9381787f7779766ec5 (patch)
tree4e9018e0f0dac786f0cc6cc4a14ecc3b9e4a95c6 /src/mspdb.cpp
parentd331d1f1a15e28a1ca9b0747cfe7e9f363eab878 (diff)
downloadcv2pdb-191f0a0b1131e5d095637a9381787f7779766ec5.zip
cv2pdb-191f0a0b1131e5d095637a9381787f7779766ec5.tar.gz
cv2pdb-191f0a0b1131e5d095637a9381787f7779766ec5.tar.bz2
fix loading 64-bit mspdb140.dll in VS2019
Diffstat (limited to 'src/mspdb.cpp')
-rw-r--r--src/mspdb.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mspdb.cpp b/src/mspdb.cpp
index 00684ed..4267ac8 100644
--- a/src/mspdb.cpp
+++ b/src/mspdb.cpp
@@ -113,9 +113,31 @@ bool tryLoadMsPdbCom(const char* mspdb, const char* path = 0)
WideCharToMultiByte(CP_ACP, 0, installDir, -1, modpath, 260, NULL, NULL);
SysFreeString(installDir);
+#ifdef _WIN64
+ strncat(modpath, "\\VC\\Tools\\MSVC\\*", 260);
+ WIN32_FIND_DATAA data;
+ HANDLE hFind = FindFirstFileA(modpath, &data); // DIRECTORY
+
+ if (hFind != INVALID_HANDLE_VALUE)
+ {
+ int len = strlen(modpath) - 1;
+ do
+ {
+ modpath[len] = 0;
+ strncat(modpath, data.cFileName, 260);
+ strncat(modpath, "\\bin\\Hostx64\\x64\\", 260);
+ strncat(modpath, mspdb, 260);
+ tryLoadLibrary(modpath);
+ }
+ while (!modMsPdb && FindNextFileA(hFind, &data));
+ FindClose(hFind);
+ }
+
+#else
strncat(modpath, "\\Common7\\IDE\\", 260); // wrong path for x64 build of cv2pdb
strncat(modpath, mspdb, 260);
tryLoadLibrary(modpath);
+#endif
}
return true;