views:

89

answers:

1

Hi,

My project has a bunch a solutions containing several projects. There're 2 Configurations:

  • Release (/MT)
  • Debug (/MTd)

We have a 3rd party library. Should we have 2 version of it for each Configuration (Release version compiled with /MT and Debug version compiled with /MTd) or it's enough to have one version (/MT or /MTd)?

Thanks Dima

+6  A: 

In general, you'll need to have two versions of that external library also, and consistenly compile everything for debug or for release. The problem is that mixing different C runtimes (CRTs, e.g. debug and release CRT) can cause crashes.

There is one exception where you can get away with a release version only: if the external library is a DLL, and if you don't pass any CRT objects from one CRT to the other, the restriction does not apply.

CRT objects are FILE pointers, malloc blocks (only if one library allocates, and the other releases), the notion of a current locale, and the notion of timezone.

Martin v. Löwis