Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is /clr incompatible with /mt and /mtd in Visual Studio?

can anybody please explain for me how and why /clr is incompatible with /mtd ? What is the alternative for this? What happens internally if I use /md or /mdd ?

As far as I know we don't combinedly use /clr and /mtd. Can someone explain if there is a way to do this? And please explain me how and why /clr is incompatible with /mt and /mtd in Visual Studio?

like image 260
Cute Avatar asked Jun 02 '09 08:06

Cute


1 Answers

I expect the clue is given here:

If you are using the /clr compiler switch, your code will be linked with an import library, msvcmrt.lib. The import library references a new library, msvcm80.dll, which provides a proxy between your managed code and the native CRT. You cannot use the statically linked CRT ( /MT or /MTd options) with /clr. Use the dynamically-linked libraries (/MD or /MDd) instead.

The /clr flag causes your code to reference a new dll msvcm80.dll - this acts as a proxy between your managed code and the CRT. It's difficult to say exactly what this proxy does, but I guess it acts as an interface for allocations on the managed heap, garbage collection, managed threads and that kind of thing. If you link the static versions of the CRT, then the proxy would not be able to intercept your calls to the runtime libraries.

like image 96
1800 INFORMATION Avatar answered Oct 04 '22 16:10

1800 INFORMATION