core.sys.windows.windows and TCHAR

Adam D. Ruppe destructionator at gmail.com
Fri Jan 10 14:17:16 PST 2014


On Friday, 10 January 2014 at 14:02:13 UTC, Regan Heath wrote:
> IIRC wchar_t is actually UCS-2

eeek, I think you're right. I thought that changed a while ago 
but doesn't look like it. Megannoying... but still better than 
ascii at least.

> Having a way to opt back into ascii would be desirable in some 
> cases though.  So, I think we want both sets of aliases in 
> version blocks (Ascii and Multibyte) and we actually want the 
> compiler to define the default of Multibyte which would be 
> overridden by version=Ascii on the command line.

That would work for me.

> Remind me, cos I haven't looked in ages.  Do we define 
> prototypes for both the A and W versions of functions outside 
> of version() blocks?

There's very few definitions of the W functions in druntime at 
all; it uses only the A versions for the most part.

> Then use version blocks to alias either the W or A to a name 
> without either? (in the same way the windows headers do)

The Win32 headers on dsource do this, but druntime doesn't. Since 
druntime is so woefully incomplete, to do real work you're almost 
always doing your own declarations or using a downloaded binding 
anyway, but still, i'd like at least the basic types in 
core.sys.windows.windows to be sane. (BTW, mixing these is a 
pain: I was doing a COM server and started with druntime's 
definition. But I had to add automation and druntime doesn't have 
IDispatch, so I moved to the dsource.org bindings.... and then 
there were conflicts between its IUnknown and druntime's 
IUnknown. So the little bit of code I imported from the druntime 
lib had to be worked around somehow. Soooo annoying.

I'd love for dmd to come with complete bindings and library 
files, and most the Windows D devs seem to agree, but it is 
apparently easier said than realized. But doing these basic types 
is a step forward too and shouldn't be as hard.)


More information about the Digitalmars-d mailing list