views:

63

answers:

3

I need some basic clarification on C++ static linkage. I have a file called data_client.lib. There are three independant consumers for the library file a.exe, b.exe and c.exe. There is a service called data_server.exe for which data_client.lib is the interface. Actually, I added another function to data_server.exe and corresponding interface to data_client.lib. Since just a.exe needs the extra functionality, I build a.exe only. I shipped data_server.exe, data_client.exe and a.exe as patch. Now, b.exe and c.exe randomly/inconsistently crashes throwing

mfc42u!CException::`RTTI Complete Object Locator'+0x10

Does it make sense? If I also build b.exe and c.exe, then the crash does not happen. Is this the way it works?

+2  A: 

Maybe You don't have explicit dependencies, but some of Your project headers uses, or put information implicitly into your library.

bua
+2  A: 

I do not know about the error, but your applications b.exe and c.exe are using an older version of the binding lib to communicate with a newer version of the data_server.exe. Some v_table indexes might be off or something if you added a function. You definately have to rebuild all the libraries.

Space_C0wb0y
+2  A: 

Actually, I added another function to data_server.exe and corresponding interface to data_client.lib.

It's a little unclear from this exactly what was added to your library. However, if it's a new method or methods added to a class (rather than just some new standalone functions), there's a very high chance that recompiling everything will fix your problem. The vtable may or may not have been thrown out of whack by your changes.

It's also possible that your crashes have absolutely nothing to do with this and there's some other problem going on... but from your description, my money's on a vtable issue. If it were me, I'd recompile b.exe and c.exe and test again before investigating other issues.

Russell Newquist
Yes, new method is added to an existing class.
bdhar