简体   繁体   English

如何使用 MinGW 在 Windows 机器上处理 are.a 文件

[英]How are .a files handled on Windows machines using MinGW

I've seen from resources that .a files are static library files for UNIX Systems, and that .lib files are the equivalent but for UNIX systems.我从资源中看到.a文件是 UNIX 系统的 static 库文件,而.lib文件是等效的,但适用于 UNIX 系统。 I'm beginning to try to import libraries in projects and saw that for SDL2 specifically, there are.a files that I include with my linking commands with minGW is there something under the hood that is going on for these files to be read and used on a Windows machine?我开始尝试在项目中导入库,并看到特别是对于 SDL2,有一个文件包含在我与 minGW 的链接命令中,是否有一些正在发生的事情可以读取和使用这些文件在 Windows 机器上?

I've linkedthese successfully (and not-so-successfully a few hours ago),but this bugged me so I wanted to ask you all:)我已经成功地链接了这些(几个小时前还不太成功),但这让我很烦恼,所以我想问问大家:)

On Windows machines using MinGW, .a files (also known as static library files) are handled by the linker (ld.exe) during the linking stage of the compilation process.在使用 MinGW 的 Windows 机器上,.a 文件(也称为 static 库文件)在编译过程的链接阶段由 linker (ld.exe) 处理。 The linker takes the object files (.o) generated by the compiler (gcc.exe) and combines them with the code and data stored in the.a files to create a single executable file. linker 将编译器 (gcc.exe) 生成的 object 文件 (.o) 与存储在 .a 文件中的代码和数据组合起来,创建一个单一的可执行文件。 The linker also resolves any symbol references between the object files and the library code and data. linker 还解析 object 文件与库代码和数据之间的任何符号引用。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM