[fpc-devel] Re: Changing Windows API A routines in SysUtils to W in Windows NT

Craig Peterson craig at scootersoftware.com
Mon Feb 6 21:04:11 CET 2012


On 2/6/2012 1:55 PM, Thaddy wrote:
> It is known which versions are unicode. I am merely refering to the OS
> version flags. These are the ones which determine if the windows version
> is unicode or ansi.
> There's no point in running an ansi compiled  exe on a unicode platform.
> Once a programmer decides his/hers minimum requirements, the compiler
> should obey. The OS does (up to a certain point)
> These decisions should be made by the compiler based on platform choice,
> not in rtl code. That should be optional (as of 2010/XE this is also D
> compatible)

In C on Windows the UNICODE symbol controls whether undecorated
functions should use the A or W versions, and what the TCHAR symbol
translates to.  There's nothing stopping an application from calling the
A or W versions explicitly, and it's entirely possible for an otherwise
Unicode app to use the A versions for certain functions.  That's handled
by the compiler's pre-processor, not the linker and not the loader.

Delphi does the same thing, except the change was built into the
language, rather than done using a conditional symbol, and the A or W
decision was hard-coded rather than wrapping them in {$IFDEF UNICODE}
blocks.

-- 
Craig Peterson
Scooter Software




More information about the fpc-devel mailing list