STATIC DEFINE DWORD_DEFINE := 0x00000001 AS DWORD
FUNCTION Start() AS VOID STRICT
LOCAL a AS OBJECT[]
a := <OBJECT>{ DWORD_DEFINE }
? a[1]:GetType():ToString() // displays System.Int32 instead System.UInt32
RETURN
Leonid,
This is a problem that Chris and I recently also discovered with some if the Windows SDK defines.
If you look at the app with reflector then you'll see that the DEFINE is stored as INT.
The "AS <type>" clause for DEFINES is new in X# and apparently not always processed correctly.
If you write the define as 0x00000001U then the value will be a DWORD and the element in the object array as well.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Robert,
Yesterday I added U to DWORD constants, as you suggested, and my code started to work correctly. But of course, if a type is explicitly specified for DEFINE, then this is the type that should be used. Thanks again.