Is mixing battery life a viable solution?

At my company, we recently switched from VC9 to VC10.

We transferred our projects, but then the person in charge told us that for some time we would need to use some basic DLLs compiled with VC9 on our production machines.

These DLLs use custom structures, some of which contain std::vector, std::mapand so on. Now it occurred to me that the size of the standard containers had changed: some became larger, some became smaller. As a result, the dimensions of our custom structures have changed.

To solve the problems caused by resizing, my colleague thought about artificially increasing the size of our structures, to make it possible to compensate for the resizing of future members, so that the structures remain the same size, regardless of the time we use, preventing damage to the stack when called functions.

Personally, I feel that this “solution” is terrible, because while size matters, so is the layout of the structures. For me, increasing the memory capacity of all structures to eliminate organizational problems seems really wrong.

To do this briefly, my question is: is it possible to simultaneously use two different versions at the same time (using the described trick or any other trick) when using non-C types in function prototypes? Do you have good / bad experience regarding a similar situation?

+5
source share
3 answers

STL never guaranteed binary compatibility between different major versions. So, if you have a DLL with STL classes on the interface, you should use the same compiler and the same CRT flavor for the DLL client and the DLL itself.

If you want to create a DLL that can be safely used with different versions of the compiler, you have several options, for example:

  • C (DLL ++, C, ++ DLL).
  • DLL, .
  • COM.
+9

, -, , , . , ++ , , .

, , VC9, VC10, , VC9 . " ", , , , , , , . , , , std::vector, ( , , ).

, , , - .

+1

, . , , , ABI : , , , ++ ( ABI ) DLL , . , VC10 ++ 11. C, DLL, , .

It’s hard for me to suggest a specific case when things really will eat it, but let me tell you this: these are mistakes that you do not expect that it will bring to you, and this is a real nest of hornets.

+1
source

All Articles