Open lawrenceamer opened 5 days ago
it seems it is not part of Mingw64 https://github.com/msys2-contrib/mingw-w64/blob/master/mingw-w64-headers/include/memoryapi.h
@nektro I think you are referring to the following
pub extern "api-ms-win-core-memory-l1-1-5" fn UnmapViewOfFile2(
Process: ?HANDLE,
BaseAddress: ?*anyopaque,
UnmapFlags: UNMAP_VIEW_OF_FILE_FLAGS,
) callconv(@import("std").os.windows.WINAPI) BOOL;
and thats limited to windows10.0.15063 check out here : https://github.com/marlersoft/zigwin32/blob/32d085ee67374ad2ec24fc012e6876ca27958fb7/win32/system/memory.zig#L1098
As a workaround, does NtMapViewOfSection suit your use case?
@mesidex NtMapViewofSection is different than MapViewFile2, however i managed to make it work with following extern API inline call.
https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffilenuma2
pub extern "api-ms-win-core-memory-l1-1-5" fn MapViewOfFileNuma2(
FileMappingHandle: HANDLE,
ProcessHandle: HANDLE,
Offset: u64, // ULONG64
BaseAddress: ?*anyopaque, // PVOID (optional)
ViewSize: usize, // SIZE_T
AllocationType: u32, // ULONG
PageProtection: u32, // ULONG
) callconv(windows.WINAPI) ?*anyopaque; // Returns PVOID
Zig Version
0.13.0
Steps to Reproduce and Observed Output
it seems MapViewOfFile2 is not declared or linked into Zig code base yet, currently i am declaring it externally :
raising the following linking error :
any alternative solution? if we imported the C headeand then call it from it's name space should be a temporary solution?
Expected Output
error: warning(link): unexpected LLD stderr: lld-link: warning: undefined symbol: MapViewOfFile2