Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Molenkamp <github@lazydodo.com>2020-05-03 21:07:22 +0300
committerRay Molenkamp <github@lazydodo.com>2020-05-03 21:07:22 +0300
commitff8288ad1e6997be6ada29543b6abdba18f47b24 (patch)
tree7ab71226b211f6b81e8b9cb5fd536ef0695f63ac /source/blender/blenlib
parentfe891d581dfece13b42414ba1d8fec6063290a31 (diff)
Windows: Replace BLI_File* calls with system calls in system_win32.c
Using BLI calls in this file triggered a condition where poorly modelled dependencies in cmake (ie bf_blenlib using zlib headers but not linking the libraries) leading to linker error in debug builds of some of the tests. This diff sidesteps the dependencies issue by using native calls rather than BLI calls to check if a file exists and what its size is. Effectively sweeping the issue right back under the rug where I found it. The best solution would be to audit all libraries and ensure they have proper link requirements set, but that requires significantly more time than I have available right now. (zlib in blenlib was one of them and would have been easy to fix, but there were others that required more work) The alternative is tests that fail to build which worse. I'll revisit this and fix it properly but for now this will have to do.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/system_win32.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/source/blender/blenlib/intern/system_win32.c b/source/blender/blenlib/intern/system_win32.c
index f4c9057114c..4fea47386ea 100644
--- a/source/blender/blenlib/intern/system_win32.c
+++ b/source/blender/blenlib/intern/system_win32.c
@@ -24,8 +24,6 @@
#include <shlwapi.h>
#include <tlhelp32.h>
-#include "BLI_fileops.h"
-#include "BLI_path_util.h"
#include "BLI_string.h"
#include "MEM_guardedalloc.h"
@@ -319,24 +317,29 @@ static void bli_load_symbols()
PathRemoveFileSpecA(pdb_file);
/* append blender.pdb */
PathAppendA(pdb_file, "blender.pdb");
- if (BLI_exists(pdb_file)) {
+ if (PathFileExistsA(pdb_file)) {
HMODULE mod = GetModuleHandle(NULL);
if (mod) {
- size_t size = BLI_file_size(pdb_file);
-
- /* SymInitialize will try to load symbols on its own, so we first must unload whatever it
- * did trying to help */
- SymUnloadModule64(GetCurrentProcess(), (DWORD64)mod);
-
- DWORD64 module_base = SymLoadModule(
- GetCurrentProcess(), NULL, pdb_file, NULL, (DWORD64)mod, (DWORD)size);
- if (module_base == 0) {
- fprintf(stderr,
- "Error loading symbols %s\n\terror:0x%.8x\n\tsize = %zi\n\tbase=0x%p\n",
- pdb_file,
- GetLastError(),
- size,
- (LPVOID)mod);
+ WIN32_FILE_ATTRIBUTE_DATA file_data;
+ if (GetFileAttributesExA(pdb_file, GetFileExInfoStandard, &file_data)) {
+ /* SymInitialize will try to load symbols on its own, so we first must unload whatever it
+ * did trying to help */
+ SymUnloadModule64(GetCurrentProcess(), (DWORD64)mod);
+
+ DWORD64 module_base = SymLoadModule(GetCurrentProcess(),
+ NULL,
+ pdb_file,
+ NULL,
+ (DWORD64)mod,
+ (DWORD)file_data.nFileSizeLow);
+ if (module_base == 0) {
+ fprintf(stderr,
+ "Error loading symbols %s\n\terror:0x%.8x\n\tsize = %d\n\tbase=0x%p\n",
+ pdb_file,
+ GetLastError(),
+ file_data.nFileSizeLow,
+ (LPVOID)mod);
+ }
}
}
}