September 07, 2012
I'm having linking errors on win32 for a couple of static members in C++ stdlib.

Here's a C++ test file:
http://codepad.org/0cbnzent

C++ driver:
http://codepad.org/A5Cs5gGd

$ g++ -c -m32 localeTest.cpp
$ g++ -m32 driver.cpp localeTest.o -lstdc++

Linking works. Now a D driver:
http://codepad.org/LEoNUOXG

$ g++ -c -m32 localeTest.cpp
$ gdc -m32 driver.d localeTest.o -lstdc++

I get an LD error:
localeTest.o:localeTest.cpp:(.text$_ZN3Foo4testEv[__ZN3Foo4testEv]+0x20):
undefined reference to `std::locale::facet::_S_lc_ctype_c_locale(int*,
char const*)'
collect2: ld returned 1 exit status

Another symbol I've tried that gives me linking errors via GDC is: `std::basic_istream<wchar_t, std::char_traits<wchar_t> >::ignore(int, unsigned short)'

Here's what g++ -v says: http://pastebin.com/5sdGB34s
And gdc -v: http://pastebin.com/BqWtzRMY

Maybe gdc is configured differently from g++ and g++ links in something gdc doesn't? I can't see much difference in verbose output except the "-Bstatic/-Bdynamic" in g++ output which are VxWorks options, but they don't make a difference here.