-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
undefined symbol: MapViewOfFile2 #22040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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
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? zig/lib/std/os/windows/ntdll.zig Line 144 in e163ae7
|
@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 |
I have it:
|
The problem is that it isn't present in any of MinGW-w64's library definition files. Someone needs to file a bug or send a patch upstream. |
I use mingw since around 2008, and there is no problem with this function. mingw-w64 provides the header files and the import libraries. The DLL is in the system. I used it for example in the EFL and I compile on Windows and cross compile on linux without any problem |
The only occurrence of |
From MSDN:
|
Ah, I wasn't aware of that detail. Then this still looks like a MinGW-w64 bug, because it declares |
that's how it is defined in the visual studio SDK. I've just reported this to the mingw-w64 devs and one of them told me that he will fix it soon |
@alexrp @vtorri I don't think it is an issue with mingw-w64 while it is working perfectly if you depend on cc compiler. the issue that there is no binding for this specific API call because it is inline function which i fixed in previous extern inline call. it can be fixed by ziglang and not in mingw64 |
at least, other people who need MapViewOfFile2() will be able to use it |
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
The text was updated successfully, but these errors were encountered: