Skip to content

Commit 11399d7

Browse files
committed
add typedef of WIN32_MEMORY_RANGE_ENTRY and PWIN32_MEMORY_RANGE_ENTRY to make it work under MinGW
1 parent 9a849b6 commit 11399d7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/llama.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,6 +1820,13 @@ struct llama_mmap {
18201820

18211821
if (prefetch > 0) {
18221822
// PrefetchVirtualMemory is only present on Windows 8 and above, so we dynamically load it
1823+
#if (_WIN32_WINNT < _WIN32_WINNT_WIN8)
1824+
typedef struct _WIN32_MEMORY_RANGE_ENTRY {
1825+
PVOID VirtualAddress;
1826+
SIZE_T NumberOfBytes;
1827+
} WIN32_MEMORY_RANGE_ENTRY, *PWIN32_MEMORY_RANGE_ENTRY;
1828+
#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
1829+
18231830
BOOL (WINAPI *pPrefetchVirtualMemory) (HANDLE, ULONG_PTR, PWIN32_MEMORY_RANGE_ENTRY, ULONG);
18241831
HMODULE hKernel32 = GetModuleHandleW(L"kernel32.dll");
18251832

0 commit comments

Comments
 (0)