-
Notifications
You must be signed in to change notification settings - Fork 118
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
Prefer Pointer
than int
/IntPtr
#363
Comments
These should be integer values though, no? They are sized to the same width as a (Arguably, |
Then why |
Ah, that's a great question! The answer is that Here's the definition in winnt.h: typedef void *HANDLE;
#define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name If Windows was being written today, or with a different language in mind than C, they might have done things differently. But C doesn't know whether a Pointer is being used as a reference to a memory address or just as an opaque index. You can see that there's an attempt with the Of course, ffigen knows nothing about these semantics or higher level Windows programming abstractions like COM. That's why I haven't adopted it for win32, even though it's a great tool. You and I are not the only ones who grapple with this - see here: microsoft/win32metadata#21 |
There is a similiar question on Then should we use |
I'm sorry -- I wish I could help you with that question, but I don't know much about macOS development. Although I switch around devices a fair amount, when it comes to development, Windows is my niche! |
Thanks very much for your answer on Windows. Closing this |
Problem
After applying
type-map
withpackage:win32
,HANDLE
andHWND
changed fromPointer
toIntPtr
Both before and after work. But I prefer type-safe
Pointer
thanInt
/IntPtr
Request
Could we change
HANDLE
andHWND
toPointer
?https://github.com/timsneath/win32/blob/4d0e4dec9bafcddef331aa96244b9d59836ce87c/lib/src/types.dart#L30
https://github.com/timsneath/win32/blob/4d0e4dec9bafcddef331aa96244b9d59836ce87c/lib/src/types.dart#L41
The text was updated successfully, but these errors were encountered: