Get aliased type

John Chapman johnch_atms at hotmail.com
Tue Jan 2 12:45:48 UTC 2018


On Tuesday, 2 January 2018 at 12:19:19 UTC, David Nadlinger wrote:
> There is indeed no way to do this; as you say, aliases are just 
> names for a particular reference to a symbol. Perhaps you don't 
> actually need the names in your use case, though?
>
>  — David

The idea was to distinguish between a BSTR (an alias for wchar* 
from core.sys.windows.wtypes used widely with COM) and wchar* 
itself, chiefly so that I could call the appropriate Windows SDK 
functions on them to convert them to and from D strings. Although 
BSTRs look like wchar*s to the end user they are not really 
interchangable - for example, calling SysFreeString on a regular 
wchar* will cause a crash.

According to the docs, a BSTR is prefixed with its length and 
ends in a null character, but I'm not sure if checking for the 
existence of those is going to be good enough.


More information about the Digitalmars-d-learn mailing list