前面:
#ifdef LINUX
#define DECL2
#define EXPORTSPEC
typedef struct dost {
int rfd;
int wfd;
// int connectionType; // remember whether this is a socket or a serial connection or a handle or whatever
} _daveOSserialType;
#include
#define tmotype int
#define OS_KNOWN // get rid of nested ifdefs.
#endif
后面:
EXPORTSPEC char * DECL2 daveStrerror(int code); // result is char because this is usual for strings
这里的3个:
#define DECL2
#define EXPORTSPEC
#define OS_KNOWN // get rid of nested ifdefs.
没搞明白,高手?
不用纠结,根据代码,这些宏在Linux平台下的值是空,所以在展开时这些宏其实是没用的。
至于这么定义的原因只是为了保持在不同平台下的代码一致性而已。
楼上回答正确,如果移植到别的平台,这几个宏可能就有值了。是为了跨平台用的。