Conditional Compilation for Specific Windows

Jonathan Marler via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 7 11:14:59 PST 2015


On Wednesday, 7 January 2015 at 18:50:40 UTC, Jacob Carlborg 
wrote:
> On 2015-01-07 19:27, Jonathan Marler wrote:
>> I'm looking at the Windows multicast API.  It has different 
>> socket
>> options depending on if you are on Windows XP or Windows Vista 
>> (and
>> later).  Is there a way to tell at runtime which version of 
>> windows you
>> are on? Note: I'm specifically talking about runtime because I 
>> want the
>> same binary to run on all windows versions so I have to 
>> support both and
>> determine which one I am running on at runtime.
>
> Use the regular system API's as you would in C. Should be easy 
> to find if you search the web.

They are the regular system APIs.  They change depending on which 
version of windows you are on 
(http://msdn.microsoft.com/en-us/library/windows/desktop/ms738558(v=vs.85).aspx). 
  Again, how do I determine which version of windows I am on?  My 
code will default to using the new API (because it is the most 
efficient), but then will fall back to using the old API if it 
can detect that the current version of Windows does not support 
the new API.


More information about the Digitalmars-d-learn mailing list