« October 2004 | Main | December 2004 »

November 21, 2004

Maddening VC7 linkage problem resolved

I'm writing this mainly for Google: I searched high and low for a solution to this problem and ended up having to solve it myself. Two very long days.

I have a smallish (~20k lines) printing system that I build under Win32, and I just converted from MS Visual C version 6 (very old) to .NET2003 (VC7). The compiler is clearly running better, but I was getting linkage errors:

LIBC.lib(_wctype.obj) : error LNK2005: _iswlower already defined in file2.obj
The error was always with one of the wide-character ctype-like macros:
_iswalpha _iswupper _iswlower _iswdigit _iswxdigit _iswspace _iswpunct _iswalnum _iswprint _iswgraph _iswcntrl _iswascii
It seems that if one includes <tchar.h> before <windows.h>, the compiler instantiates these inline functions, so they end up being multiply defined. These code fragments demonstrate the problem:
file1.cpp
#include <windows.h>
#include <tchar.h>

int _tmain(void)
{
        return iswlower('x') || iswalnum('x');
}

file2.cpp
#include <tchar.h>
#include <windows.h>

BOOL function2(wchar_t *s)
{
        return iswlower(*s);
}

Note here that the two #include files are not in the same order, but in a very large system, this kind of thing doesn't jump out at you (especially when they are in a per-directory "common.h" file used as an anchor for precompiled headers).

Trying to build this:


C> cl -o main.exe /nologo /D_UNICODE file1.cpp file2.cpp
file1.cpp
file2.cpp
Generating Code...
LIBC.lib(_wctype.obj) : error LNK2005: _iswlower already defined in file2.obj
main.exe : fatal error LNK1169: one or more multiply defined symbols found

The solution has been to insure that <tchar.h> always follows <windows.h> (or <winsock.h>). I've queried the VC newsgroups, but it sure looks like a bug (or at least a misfeature) to me. Ugh.

Posted by steve at 05:16 PM | Comments (2) | TrackBack

November 18, 2004

"whack whack"

In the old days of uucp email routing, we had addresses like ihpn4!uunet!mtndew!steve. Saying "exclamation point" out loud several times when telling somebody your address is very tedious, so (somehow) this evolved to "bang":

"My email address is ihnp4 bang uunet bang mtndew bang steve"
(of course, some wise guy named his computer "bang")

While at the Microsoft MVP Security Summit last week, I found that another character has developed its own alter-spoken-ego: "backslash" is spoken as "whack".

"My F: drive mounts from whack whack server whack data" (\\server\data)
It seems perfectly natural for something like this to have developed, but I'm surprised I'd never run into this before. It's not in ESR's Jargon File.

I've been informed that the primary usage is for a forward slash, so perhaps the provenance of this term is not entirely clear.

This is delightful.

Posted by steve at 10:51 AM | Comments (4) | TrackBack

November 07, 2004

Off to Microsoft SecuritySummit!

I got my Microsoft MVP award renewed for another year, mainly for my work in the BroadbandReports Security Forum, and tomorrow I'm heading up to Redmond for a mini Security Summit.

Microsoft holds a Global MVP Summit in the spring, and ~2000 of us show up for a week of technical breakout sessions, but they decided to hold a mini summit for just the security folks: I think there will be 50-60 of us.

Pretty much "all security, all the time", but I will take time out for lunch with my new friends in the Printing/Imaging group: though my MVP status is not really related to them, I've begun to participate informally in an online chat and conference call, and this fits in nicely with my print-driver work. Maybe I'll call it an MVP "minor" to my security "major"

The highlight of the trip is dinner at the Space Needle Wednesday evening. I'm bringing my binoculars :-)

----

Sadly, comment spam has gotten so bad that I've had to enable moderation. I'm nearly always at my keyboard (save for next week), so comments should be approved quickly. I hope to find a better solution to this problem. Spammers suck.

Posted by steve at 08:52 AM | Comments (1) | TrackBack

November 01, 2004

Not the only guy who writes about the ballot...

I've been writing about the ballot propositions for several years (though only the last couple of elections are online), but I tripped across another fellow who's been doing it for 25.

He and I don't completely share views on everything, but his rationale looks rock solid even for things I don't agree with. He's clearly gotten good at this kind of analysis.

Pete Rates the Propositions

Posted by steve at 02:53 PM | Comments (0) | TrackBack