From 35ee170413434420bf5adcb077a80aa2f238655a Mon Sep 17 00:00:00 2001 From: LIU Xiao Date: Fri, 5 Jul 2024 17:43:08 +0800 Subject: [PATCH] add typedef of WIN32_MEMORY_RANGE_ENTRY and PWIN32_MEMORY_RANGE_ENTRY to make it work under MinGW --- src/llama.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/llama.cpp b/src/llama.cpp index bc88c8487..6caf74e51 100644 --- a/src/llama.cpp +++ b/src/llama.cpp @@ -1802,6 +1802,13 @@ struct llama_mmap { if (prefetch > 0) { // PrefetchVirtualMemory is only present on Windows 8 and above, so we dynamically load it +#if (_WIN32_WINNT < _WIN32_WINNT_WIN8) + typedef struct _WIN32_MEMORY_RANGE_ENTRY { + PVOID VirtualAddress; + SIZE_T NumberOfBytes; + } WIN32_MEMORY_RANGE_ENTRY, *PWIN32_MEMORY_RANGE_ENTRY; +#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN8) + BOOL (WINAPI *pPrefetchVirtualMemory) (HANDLE, ULONG_PTR, PWIN32_MEMORY_RANGE_ENTRY, ULONG); HMODULE hKernel32 = GetModuleHandleW(L"kernel32.dll");