Replies: 2 comments 1 reply
-
(C# projection author) I think it's a little hokey, but I can't think of a better idea. I believe you're already doing this in some cases (one enum comes to mind) and it's tolerable, so I say move ahead. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Wonky but so long as we can parse the field signature and get all of this information it should be doable. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
ECMA-335 allows for constants, but the values can only be strings or scalar values like int, uint, etc. It doesn't support constant values IntPtr or Guid, for example.
Win32 has lots of constants for types other than string or scalar values, like GUIDs and IntPtr:
From the C headers:
ECMA-335 allows for a complex type for a field whose constant value is not of the same type. So we can do this:
C#:
Which in the metadata is represented with:
.field public static literal valuetype [Windows.Win32.winmd]Windows.Win32.Gdi.HBITMAP HBMMENU_CALLBACK = int32(-1)
We could do the same thing with GUIDs:
It would be up to the projector to figure out how to set the complex type with the string/scalar. What do language projection writers think about this proposal?
Beta Was this translation helpful? Give feedback.
All reactions