Hello.
I'm desperate because I have one project that uses a third party DLL and receives data in a Vector.
The original project works fine in VC6, and compiles perfectly with no errors in VS2010, but when executing it, we get some weird behaviour:
- The result (that comes in a Vector format) has the first element of the vector OK but the rest are messed up, as if there was some kind of memory overlapping or something.

We tried with the Daffodil framework patch (it allows you to use the VS2010 IDE against VC6 framework) and then it works, but again if we try to use the VS2010 framework we will end up with the same Vector problem/error.

We think the answer is in some configuration parameter in the VS2010 IDE, but were unable to find it yet...

We hope anyone can give as a clue to what to change or what to try.

Thank you in advance.

Recommended Answers

All 2 Replies

The result (that comes in a Vector format) has the first element of the vector OK but the rest are messed up, as if there was some kind of memory overlapping or something.

Sounds like some x32 code is now built on x64 and fails. Verify that all types are still the same (byte)size. Do you have just the DLL, or do you also have the source?

VC6 and VS2010 are not binary compatible (neither are most versions of Microsoft's compilers, they just change it every time, even for revisions on the same version). This means that the binary layout of classes (e.g. how the objects look in memory) can be significantly different between those two versions.

If your third party DLL was compiled for VC6, then you cannot use it with VS2010. You will get exactly the kind of issue you are describing (you get objects back from it that appear to be half correct but all messed up). You need to either get a newer version of that DLL that is compiled for VS2010 (or compile that DLL yourself from the sources, if you have them). And if that is not available, you will have to resort to a much more drastic approach, which is to wrap all the functions of a DLL into a C API (not C++) that you export from your own DLL which you compile with VC6, and then you use that DLL in your VS2010 project (because C APIs are always binary compatible, but it means that you cannot use any C++ features for those exported functions). That latter solution is pretty intense in terms of work and re-writing of code.

Microsoft compilers have never had a stable ABI (binary interface specification), meaning that you must always ensure that your third party libraries are either specifically made for the same compile version that you have, or that they only have a C API. That's why so many third party libraries just have a C API, even if they are coded in C++ under the hood.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.