简体   繁体   English

MSVC 编译器中的 /Fx 选项是什么意思?

[英]What is the meaning of the /Fx option in MSVC compiler?

In the MSVC compiler, there is the option /Fx which generates merged source files.在 MSVC 编译器中,有选项/Fx可生成合并的源文件。 However, on the documentation of the option, there is no information about how to inject code into my source files nor what is the purpose of doing it.但是,在该选项的文档中,没有关于如何将代码注入到我的源文件中的信息,也没有说明这样做的目的是什么。

If I take a dummy C++ project and add the /Fx option, nothing changes, no .mrg file is generated:如果我使用一个虚拟的 C++ 项目并添加/Fx选项,则不会发生任何变化,也不会生成.mrg文件:

> cl.exe /c test.cpp /Fx

I have found no example of a usage of this option.我没有找到使用此选项的示例。 I didn't find anything about code injection either.我也没有找到任何关于代码注入的信息。

So, how to inject code into a source file?那么,如何将代码注入到源文件中呢? What is the purpose of this feature?此功能的目的是什么?

I found https://assets.ctfassets.net/9pcn2syx7zns/524v1rKJCe8GHLT3OE8nso/0c198e1ab4059da9cd902f120defa4b5/c__.pdf which, on page 198, explains that this is for attributes .我发现https://assets.ctfassets.net/9pcn2syx7zns/524v1rKJCe8GHLT3OE8nso/0c198e1ab4059da9cd902f120defa4b5/c__.pdf ,在第 198 页,解释说这是用于属性 (emphasis mine) (强调我的)

Basic Mechanics of Attributes Microsoft defines a set of C++ attributes that simplify COM programming and .NET Framework common language runtime development.属性的基本机制 Microsoft 定义了一组 C++ 属性,可简化 COM 编程和 .NET Framework 公共语言运行时开发。 When you include attributes in your source files, the compiler works with provider DLLs to insert code or modify the code in the generated object files.当您在源文件中包含属性时,编译器与提供程序 DLL 一起工作以在生成的目标文件中插入代码或修改代码。 These attributes aid in the creation of .idl files, interfaces, type libraries,and other COM elements.这些属性有助于创建 .idl 文件、接口、类型库和其他 COM 元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 链接动态库时,编译器选项“ -l”是什么意思? - What is the meaning of compiler option “-l” in linking dynamic libraries? MSVC:什么编译器开关会影响结构的大小? - MSVC: what compiler switches affect the size of structs? 了解 MSVC++ 中的“缓冲区安全检查 /GS”编译器选项 - Understanding “Buffer Security Check /GS” compiler option in MSVC++ 在什么情况下为Qt MinGW或MSVC选择什么编译器? - What compiler to choose for Qt MinGW or MSVC in what case? /d2vzeroupper MSVC 编译器优化标志在做什么? - What is the /d2vzeroupper MSVC compiler optimization flag doing? 我应该按什么顺序从 MSVC 编译器读取构建错误? - In what order should I read build errors from MSVC compiler? MSVC ++ 2008 Express Editon编译器的功能和功能 - What MSVC++ 2008 Express Editon compiler does and doesn't 什么是 -D 编译器标志 C++(clang、GNU、MSVC) - What is the -D compiler flag C++ (clang, GNU, MSVC) 什么是Linux相当于MSVC ++的选项/ d1reportSingleClassLayout? - What is the Linux equivalent to MSVC++'s option /d1reportSingleClassLayout? MSVC和FreeGlut编译器错误 - MSVC and FreeGlut Compiler Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM