Skip to content
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

LocalFree should be take void* or IntPtr as its parameter #709

Closed
AArnott opened this issue Oct 5, 2022 · 2 comments
Closed

LocalFree should be take void* or IntPtr as its parameter #709

AArnott opened this issue Oct 5, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@AArnott
Copy link
Member

AArnott commented Oct 5, 2022

Actual behavior

The LocalFree method is declared by CsWin32 as taking an nint:

[DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
internal static extern nint LocalFree(nint hMem);

Expected behavior

The method takes a pointer. Not an arbitrary pointer-sized integer. While this is just semantics, it is more intuitive to use IntPtr or (even better) void* for the parameter type.
As it is, I have to cast pointers to nint to call this method.

Same for the return type.

@AArnott AArnott added the bug Something isn't working label Oct 5, 2022
@AArnott
Copy link
Member Author

AArnott commented Oct 5, 2022

Blocked by microsoft/win32metadata#1296

@AArnott AArnott added the blocked This issue cannot be fixed without first a change to a dependency label Oct 5, 2022
AArnott added a commit that referenced this issue Oct 5, 2022
@AArnott AArnott self-assigned this Oct 7, 2022
@mikebattista mikebattista removed the blocked This issue cannot be fixed without first a change to a dependency label Mar 20, 2023
@AArnott
Copy link
Member Author

AArnott commented Mar 20, 2023

Fixed in #889

@AArnott AArnott closed this as completed Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants