Windows和Linux中的库、对象、可执行文件后缀名
中国软件工程师面试常问的问题
Just a "Scientific"(Interview) Explanation for Interview Problems for Software Engineers (most Chinese Interviews)
Windows和Linux中的库、对象、可执行文件后缀名
library, object, executable files suffix name in Windows and Linux
Linux通常依靠文件权限和shebang行(例如“#!/bin/bash”)来识别可执行文件,而Windows主要使用文件扩展名。
Linux often relies on file permissions and shebang lines (e.g., #!/bin/bash
) to identify executable files, whereas Windows primarily uses file extensions.
库
Libraries:
-
Windows:
- 动态链接库 (DLLs):
.dll
- 静态库:
.lib
- Dynamic Link Libraries (DLLs):
.dll
- Static Libraries:
.lib
- 动态链接库 (DLLs):
-
Linux:
- 动态共享库(共享对象):
.so
- 静态库:
.a
- Dynamic Shared Libraries (Shared Objects):
.so
- Static Libraries:
.a
- 动态共享库(共享对象):
对象文件:
Object Files:
-
Windows:
- 对象文件:
.obj
- 库对象文件:
.lib
,.obj
- Object Files:
.obj
- Library Object Files:
.lib
,.obj
- 对象文件:
-
Linux:
- 对象文件:
.obj
- Object Files:
.o
- 对象文件:
可执行文件:
Executable Files:
-
Windows:
- 可执行文件:
.exe
- 命令脚本:
.bat
,.cmd
- Executable Files:
.exe
- Command Scripts:
.bat
,.cmd
- 可执行文件:
-
Linux:
- 可执行文件:(不需要特定的扩展名,但通常不需要扩展名或
.out
) - Shell脚本:
.sh
- Executable Files: (No specific extension required, but commonly no extension or
.out
) - Shell Scripts:
.sh
- 可执行文件:(不需要特定的扩展名,但通常不需要扩展名或
对象文件是在计算机程序编译过程中生成的中间文件。它包含机器代码、汇编代码,或者有时两者的组合,以及链接和程序执行所需的其他信息。对象文件是程序员编写的高级源代码和最终可执行程序之间的桥梁。
An object file is an intermediate file generated during the compilation of a computer program. It contains machine code, assembly code, or sometimes a combination of both, along with other information needed for linking and program execution. Object files serve as a bridge between the high-level source code written by programmers and the final executable program.