2

Have both versions of visual studio installed on a machine. I am wondering if the lower version of visual studio can use the dll built using higher version of visual studio?

2
  • Why don't you just try it and find out?
    – jason
    May 18, 2011 at 14:45
  • simple case works, wondering if there is exceptions in complex cases. I cannot try one by one.
    – user705414
    May 18, 2011 at 15:01

3 Answers 3

3

In general, you cannot mix dlls compiled with different versions of the CRT in one program. Here's a link to the documentation at MSDN.

As others mentioned, it works if you keep the interface simple. Don't free memory allocated with one CRT in a DLL linked to another version of the CRT, don't pass FILE* and similar around. Unfortunately, it's hard to know for sure what you can do and what you can't do.

0
1

It depends on the DLL. For example, if you create a Win32 DLL, using simple parameter types and the same calling convention, it works.

1

Only if you restrict yourself to what's called a C-style interface- only primitive types, the code that allocates any resource must deallocate it, and also must abstract over non-memory resources like file handles, etc. You cannot send C++ classes or objects or deallocate memory across DLL boundaries except under some extremely strict conditions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.