A Day in the Life

A day in my life. Thoughts on leadership, management, startups, technology, software, concurrent development, etc... Basically the stuff I think about from 10am to 6pm.


Software: Good old COM....

Today I’ve been working on a C++ COM sample for the Digipede Network and I ran into a LNK1179 error, "invalid or corrupt file: duplicate COMDAT ‘_IID__ServerException’" error.

LNK1179 is a very poorly defined error and the MSDN website is of little help. There seem to be three different ways that this error message can manifest.

1. Variables or function names have the same first eight letters and compiler settings have been set such that the variables/function names are being truncated at 8, making it look like duplicates.

2. You are using Visual Studio 6.0 C++ and there is a stl bug in your code. There was a bug reported and probably fixed by now that produced this error if the user had templates with the same static variable names.

3. (My problem) .Thl files have duplicate IID values.

I was able to determine that one place _IID__ServerException was being defined was in the Digipede.Framework.tlh file. After playing around a bit I also found the IID_ServerException defined in MSCORLIB.tlh, which the Digipede.Framework.tlh includes. MSCORLIB.tlh is inheriting the #import settings from the Digipede.Framework.dll.

#import "Digipede.Framework.dll" raw_interfaces_only, raw_native_types, no_namespace, auto_search, named_guids

Here is my solution:

#import "Digipede.Framework.dll" raw_interfaces_only, raw_native_types, no_namespace, auto_search

extern "C" const GUID __declspec(selectany) LIBID_Digipede_Framework =

Notice I removed the named_guids from the #import statement and added a variable that defined my LIBID. That got everything to compile. I don’t like having the LIBID_Digipede_Framework value defined outside the Digipede.Framework.tlh file for obvious reasons and I’ve submitted a bug report on it. Maybe we’ll come up with a cleaner solution that doesn’t require a name change, but for now, I’m using the work around.


At December 12, 2006 5:40 PM, Blogger Per said...

Thanks for this note, had to debug this issue today.


Post a Comment

Links to this post:

Create a Link

<< Home