Updates to the WindowsAPI translation instructions; D2 only?

Mike Parker aldacron at gmail.com
Sat Aug 3 01:54:11 PDT 2013


On Friday, 2 August 2013 at 08:47:31 UTC, Jonathan M Davis wrote:
>> Is it possible to test at runtime if those newer functions are 
>> available,
>> use them if so, and a workaround if not?
>
> I'm not sure. Possibly. Given that we previously had code that 
> checked the
> version of Windows and used the A functions if it was running 
> on Windows 9x,
> there's probably a decent chance that something similar could 
> be done with the
> Vista vs pre-Vista time functions. I'm not sure that it would 
> be worth the
> extra complication though. What's there works. It's just not 
> quite as clean as
> it would be otherwise.
>

This actually is a rather common thing. Declare function pointers 
for the newer API functions. At run time, use LoadLibrary and 
GetProc to load them from the system DLLs. If GetProc can't find 
the symbols, you know that this version of Windows doesn't 
support them, so you fall back to the older stuff.


More information about the Digitalmars-d mailing list