Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changes between Version 8 and Version 9 of WindowsApi/Instructions

Show
Ignore:
Author:
smjg (IP: 31.53.91.53)
Timestamp:
08/19/13 23:17:08 (11 years ago)
Comment:

a few more updates

Legend:

Unmodified
Added
Removed
Modified
  • WindowsApi/Instructions

    v8 v9  
    2828== Constant #defines to enum blocks == 
    2929 
    30 Convert #defines that define integral constants into enum blocks that group the constants logically.  If you can determine the appropriate type of the constants (you may need to read the [http://msdn.microsoft.com/ MSDN] documentation to do so), then specify it as the base type of the enum. 
    31  
    32 If the enum block so defined contains consecutive values, they do not need to be explicitly specified, as D will automatically assign consecutive values to them
     30Convert #defines that define integral constants into enum blocks that group the constants logically.  If you can determine the appropriate type of the constants (you may need to read the [http://msdn.microsoft.com/ MSDN] documentation to do so), then specify it as the base type of the enum.  '''RU:''' Always use enum, not const, in order to force inlining. 
     31 
     32If the enum block so defined contains consecutive values, they do not need to be explicitly specified, as D will automatically assign consecutive values to them (with some exceptions such as the HKEY constants defined in winreg.d)
    3333 
    3434Indent the constants within an enum block with one tab character.  In each enum block, align the equals signs in a column, using spaces rather than tabs. 
    5353Sometimes in the original headers, a logical group of constants is interrupted with other declarations (e.g.  constants related to specific Windows messages).  Move these interruptions to below the whole group. 
    5454 
    55 Group constants of non-integer types (e.g.  magic values of handles or string pointers), or constants that define bit flags, using a const declaration.  Example: 
    56 {{{ 
    57 const HKEY 
    58         HKEY_CLASSES_ROOT     = cast(HKEY) 0x80000000, 
    59         HKEY_CURRENT_USER     = cast(HKEY) 0x80000001, 
    60         HKEY_LOCAL_MACHINE    = cast(HKEY) 0x80000002, 
    61         HKEY_USERS            = cast(HKEY) 0x80000003, 
    62         HKEY_PERFORMANCE_DATA = cast(HKEY) 0x80000004, 
    63         HKEY_CURRENT_CONFIG   = cast(HKEY) 0x80000005, 
    64         HKEY_DYN_DATA         = cast(HKEY) 0x80000006; 
    65 }}} 
    66  
    6755== Struct naming == 
    6856 
    9785 
    9886== Constant pointers == 
    99 A const pointer declaration, such as 
    100 {{{ 
    101  const GUID* pguid; 
    102 }}} 
    103 becomes 
    104 {{{ 
    105  CPtr!(GUID) pguid; 
    106 }}} 
    107 The CPtr template is defined in basetsd.d.  This enables the bindings to support both D 1.x and D 2.x. 
     87'''RU:''' Declare const pointers D-style, for example 
     88{{{ 
     89const(GUID)* pguid; 
     90}}} 
     91Since we are now supporting D2 only, the old CPtr template is no longer used. 
    10892 
    10993== COM interfaces == 
    151135Every module that uses this conditional compilation must privately import win32.w32api, which defines the constants used to set the minimum version of Windows an application supports. 
    152136 
    153 '''RU:''' Previously, we based this on two compile-time contstants: _WIN32_WINDOWS and _WIN32_WINNT.  Now that Windows 9x is no longer supported either by Microsoft or by DMD, we consider only _WIN32_WINNT, and ignore _WIN32_WINDOWS. 
     137'''RU:''' Previously, we based this on two compile-time contstants: _WIN32_WINDOWS and _WIN32_WINNT.  Now that Windows 9x is no longer supported either by Microsoft or by DMD, we consider only _WIN32_WINNT, and ignore _WIN32_WINDOWS.  Also, any check for _WIN32_WINNT >= 0x500 can be omitted, since we are not supporting anything older than Windows 2000. 
    154138 
    155139Rather than relying on the conditionals in the MinGW headers, it is a good idea to look on [http://msdn.microsoft.com/ MSDN] to see which Windows versions support each entity that is CC'd.