how to get the local?

Steven Schveighoffer schveiguy at yahoo.com
Wed Jun 1 07:40:27 PDT 2011


On Wed, 01 Jun 2011 10:31:45 -0400, Lloyd Dupont <ld-REMOVE at galador.net>  
wrote:

> I tried to add that to my D file
> ===
> public import std.c.windows.windows;
>
> extern(Windows)
> {
>     int GetUserDefaultLocaleName(LPWSTR lpLocaleName, int cchLocaleName);
> }
> ===
> and compile and link to kernel32.lib
>
> But I got the following compile error:
> Error    1    Error 42: Symbol Undefined _GetUserDefaultLocaleName at 8  
> C:\Dev\DTest\DTest1\Dexperiment\
>
> Any clues?

Typically, windows functions come in two varieties, the A and the W  
version.  This is hidden by a macro in C, so all you ever call is  
GetUserDefaultLocaleName (and that's how it is in the docs even).  But in  
D, which does not have a pre-processor, you must add the A (ascii) or W  
(wide) to the function name.  Try:

extern(Windows)
{
     int GetUserDefaultLocaleNameW(LPWSTR lpLocaleName, int cchLocaleName);
}

-Steve


More information about the Digitalmars-d-learn mailing list