随笔分类 -  Linux

摘要:一、套接字描述符 1、创建一个套接字 #include <sys/socket.h> int socket(int domain, int type, int protocol); //返回值:成功返回文件描述符,失败返回-1 domain:指定通信地址族,通常以AF_开头(Address Fami 阅读全文
posted @ 2025-03-31 21:31 baobaobashi 阅读(249) 评论(0) 推荐(0)
摘要:一、目标文件的格式 Linux:ELF(Executable Linkable Format) Windows:PE(Portable Executable) COFF格式:PE和ELF都是源自COFF格式,Unix最早是a.out文件格式,为了解决共享库问题,引入了COFF格式。 引入了段的机制, 阅读全文
posted @ 2023-01-23 23:09 baobaobashi 阅读(425) 评论(0) 推荐(0)
摘要:编译链接过程分析 Linux中程序的链接过程如下: #include<stdio.h> int main() { printf("hello\n"); } 预编译 gcc -E main.c -o main.i 删除#define,展开宏定义 处理条件编译指令,#if,#ifdef,#else 处理 阅读全文
posted @ 2023-01-20 11:34 baobaobashi 阅读(57) 评论(0) 推荐(0)
摘要:Linux中,构造函数和析构函数的执行顺序总结 阅读全文
posted @ 2023-01-12 16:43 baobaobashi 阅读(172) 评论(0) 推荐(0)