"Jochen Kalmbach [MVP]" <no********************@holzma.de> wrote
Is it possible to add a VC++ 6 library ot a VC++ 8 application ? if yes
how ? is it possible to link a DLL ? how ?
In general you can say:
It is *only* possible if it only exports C functions (and has not a shared
CRT).
Um, why? Since all references from the VC6 code are resolved
when linking the full image, I don't see how it could work if you
use things like CString internally, but export C functions only.
What's wrong with the shared CRT? In all other cases it is almost impossible to use an older LIB with a
newer VC-Version.
Elaborting on that, the ABI is supposed to be stable. I.e. the exact
same source code should be binary compatible. The real problem
is the runtime library.
The MFC, ATL, STL (CRT is safe in most cases) implementations
of different VC versions are not necessarily compatible at the binary
or object level.
So, as long as you don't use any of these (regardless of whether
it's in the interface or the implementation) you have good
chances that it just works.
Also note, that the defaults for some switches, which have an
impact on the ABI, have changed (e.g. /Zc:wchar_t).
Sometimes things can be greatly simplified by wrapping the lib
in a VC6 DLL. In that case all symbols in the .lib are resolved
against the VC6 libraries. You only have to make sure, that
your interface contract does not rely on any incompatible
types.
For example:
// OK; only fundamental types
class X { public:
void foo( const char* p );
private:
int i;
};
CString bar(); // BAD: CString binary layout & mangled
// name different in VC6 & 8
-hg