gpt4 book ai didi

visual-studio - 为什么/clr 与 Visual Studio 中的/mt 和/mtd 不兼容?

转载 作者:行者123 更新时间:2023-12-03 11:56:37 31 4
gpt4 key购买 nike

谁能为我解释一下/clr 如何以及为什么与/mtd 不兼容?
有什么替代方案?如果我使用/md 或/mdd 在内部会发生什么?

据我所知,我们不会同时使用/clr 和/mtd。有人可以解释是否有办法做到这一点?请解释一下/clr 如何以及为什么与 Visual Studio 中的/mt 和/mtd 不兼容?

最佳答案

我希望给出线索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.



/clr 标志使您的代码引用新的 dll msvcm80.dll - 它充当托管代码和 CRT 之间的代理。很难准确地说出这个代理的作用,但我猜它充当了托管堆上分配、垃圾收集、托管线程等的接口(interface)。如果您链接 CRT 的静态版本,则代理将无法拦截您对运行时库的调用。

关于visual-studio - 为什么/clr 与 Visual Studio 中的/mt 和/mtd 不兼容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/938539/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com