I have made a DLL with VC++ 2008 and when i use it in console application VC++ 6.0, there is an exception:
(msvcr90.dll): 0xc0000005: Access Violation
I have made a DLL with VC++ 2008 and when i use it in console application VC++ 6.0, there is an exception:
(msvcr90.dll): 0xc0000005: Access Violation
Access Violation
in this case can mean so many things, and the msvcr90.dll
reference can be very much misleading. If you pass invalid data to any of the MSVC standard library functions, the access violation will occur within msvcr90.dll
and not in your code (when viewing the stack trace or looking at the exception info.
That said, there should not, in theory, be a problem using a VC9 DLL in VC++ 6, as the ABI has not changed and the PE format is the same. You might have problems if msvcrt9.dll
is unsupported on your platform (for instance if you're running MSVC6 on Windows NT), but otherwise it means you need to review your code.
What I mean is: attach a debugger and look at what's happening beneath the scene!
One more note: when using different versions of the MSVC libraries dynamically, you MUST NOT allocate data in one library and free it in another as they are not guaranteed to be using the same heap and you can get memory corruption (and Access Violation
errors) rather easily like this. This also means that if you're writing C++, you must not create an object and then pass it by return value to the calling app as that's what will happen beneath the scenes.
If you want to build a DLL with Visual C++ version X and use it in Visual C++ version Y, you have some options:
It is also important to point out that the code which allocates memory and the code which frees memory must use the same allocator.