curl源码笔记(1)

想尝试下移植CUrl到WM下, 读源码先。

Curl为了跨平台, 提供了一个很好的config.h, 值得借鉴, Windows的适配代码如下:

 

ContractedBlock.gif ExpandedBlockStart.gif curl\src\config-win32.h
 
   
1 #ifndef __SRC_CONFIG_WIN32_H
2   #define __SRC_CONFIG_WIN32_H
3
4   /* ================================================================ */
5   /* src/config-win32.h - Hand crafted config file for windows */
6   /* ================================================================ */
7
8 /* ---------------------------------------------------------------- */
9 /* HEADER FILES */
10 /* ---------------------------------------------------------------- */
11
12 /* Define if you have the <fcntl.h> header file. */
13 #define HAVE_FCNTL_H 1
14
15 /* Define if you have the <io.h> header file. */
16 #define HAVE_IO_H 1
17
18 /* Define if you have the <limits.h> header file. */
19 #define HAVE_LIMITS_H 1
20
21 /* Define if you have the <locale.h> header file. */
22 #define HAVE_LOCALE_H 1
23
24 /* Define if you need the malloc.h header file even with stdlib.h */
25 #if !defined(__SALFORDC__) && !defined(__POCC__)
26 #define NEED_MALLOC_H 1
27 #endif
28
29 /* Define if you have the <signal.h> header file. */
30 #define HAVE_SIGNAL_H 1
31
32 /* Define if you have the <stdlib.h> header file. */
33 #define HAVE_STDLIB_H 1
34
35 /* Define if you have the <sys/time.h> header file */
36 /* #define HAVE_SYS_TIME_H 1 */
37
38 /* Define if you have the <sys/types.h> header file. */
39 #define HAVE_SYS_TYPES_H 1
40
41 /* Define if you have the <sys/utime.h> header file. */
42 #ifndef __BORLANDC__
43 #define HAVE_SYS_UTIME_H 1
44 #endif
45
46 /* Define if you have the <time.h> header file. */
47 #define HAVE_TIME_H 1
48
49 /* Define if you have the <unistd.h> header file. */
50 #if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \
51 defined(__POCC__)
52 #define HAVE_UNISTD_H 1
53 #endif
54
55 /* Define if you have the <windows.h> header file. */
56 #define HAVE_WINDOWS_H 1
57
58 /* Define if you have the <winsock.h> header file. */
59 #define HAVE_WINSOCK_H 1
60
61 /* Define if you have the <winsock2.h> header file. */
62

Curl还提供了config-max.h, 部分代码还有Symbian适配, 对于其他平台的移植是很方便的.

有些宏开关是为了支持较老的编译器, 自己用的话可以适当删去.

 

转载于:https://www.cnblogs.com/mizi/archive/2010/02/05/1664748.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值