I tried creating a literal for HWND_BROADCAST ((HWND)0xffff), which is marshalled as an IntPtr.
let [<Literal>] HWND_BROADCAST = 0xFFFFn
Visual Studio tells me: error FS0267: This is not a valid constant expression or custom attribute value.
Very well. Then I checked the documentation on F# Literals on MSDN, and I noticed that unativeint (UIntPtr) is on the list. I could use that in place of IntPtr. But:
let [<Literal>] HWND_BROADCAST = 0xFFFFun
Same error message.
So I have two questions:
- Why are
nativeintliterals not supported? Is there a reason behind it? - Why doesn't the
unativeintliteral work, even though MSDN says it should?
Using F# 3.1.2 (F# Interactive version 12.0.30815.0) on Visual Studio 2013.
I noticed bigint is also on the list, which doesn't work either. So I'm guessing it's just MSDN being wrong.