在 Visual Studio C++使用 /clr 的项目,其依赖项是否也编译为托管代码?
说得更清楚一点。如果我有一个包含两个项目的 Visual Studio C++ 解决方案,例如一个关闭了 CLR 支持的静态库,以及另一个打开了 CLR 支持且依赖于此静态库的项目,则该静态库是否会编译为托管代码? CLR 项目使用的该解决方案外部的库怎么样,它们是否也被编译为托管代码?
To be a bit more clear. If I have a Visual Studio C++ solution that has two projects, say a static library with CLR support turned off, and a second project with CLR support turned on that depends on this static library, does the static library get compiled as managed code? What about libraries that the CLR project uses that are external to this solution, do they also get compiled as managed code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,只有带有
/clr
的项目才会被编译为托管程序集。静态库将被编译为非托管代码并链接到托管 DLL 中。No, only the project with
/clr
gets compiled to a managed assembly. The static library will get compiled as unmanaged code and linked into the managed DLL.不,您的依赖项不会编译为托管代码。
您的“主”项目实际上最终包含托管和非托管代码。当您调用依赖项时,这些部分将被编译为非托管。
No, your dependencies do not get compiled as managed code.
Your "main" project actually ends up containing both managed and unmanaged code. Those parts when you call your dependency would be compiled as unmanaged.