Skip to content

Types 与宏

作用

类型和宏头提供常用辅助宏与基础类型别名。

头文件

C:

c
#include <pl/c/Macro.h>
#include <pl/c/Types.h>

C++:

cpp
#include <pl/cpp/Types.hpp>

VA_EXPAND

c
#define VA_EXPAND(...) __VA_ARGS__

用于展开可变参数宏。

PLAPI

c
#ifdef PRELOADER_EXPORT
#define PLAPI __attribute__((visibility("default")))
#else
#define PLAPI
#endif

作用:标记公开的 native 接口函数。

使用场景:

c
PLAPI void MyExportedFunction(void);

PLCAPI

c
#ifdef __cplusplus
#define PLCAPI extern "C" PLAPI
#else
#define PLCAPI extern PLAPI
#endif

作用:声明 C 风格公开函数。

基础类型

pl/c/Types.h 提供以下别名:

类型等价类型
ushortunsigned short
uintunsigned int
ulongunsigned long
llonglong long
ullongunsigned long long
ucharunsigned char
scharsigned char
byteuchar
ldoublelong double
int64long long
int32int
int16short
int8char
uint64unsigned long long
uint32unsigned int
uint16unsigned short
uint8unsigned char

注意事项

  • 新代码优先使用 pl/c/*pl/cpp/*