cpp模块中如何定义你的对外接口头文件

本文档定义了一个用于版本管理的头文件,包括主要、次要和补丁版本号,并提供了一个宏来组合这些版本号。此外,还定义了根据不同编译环境导出符号的方法。该头文件对外提供了获取当前版本号的接口。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

#ifndef __XXX_H_INCLUDED__
#define __XXX_H_INCLUDED__

#define XXX_VERSION_MAJOR 4
#define XXX_VERSION_MINOR 0
#define XXX_VERSION_PATCH 8

#define XXX_MAKE_VERSION(major, minor, patch) \
    ((major) * 10000 + (minor) * 100 + (patch))
#define XXX_VERSION \
    XXX_MAKE_VERSION(XXX_VERSION_MAJOR, XXX_VERSION_MINOR, XXX_VERSION_PATCH)


#ifdef __cplusplus
extern "C" {
#endif


#if defined _WIN32
#   if defined XXX_STATIC
#       define XXX_EXPORT
#   elif defined DLL_EXPORT
#       define XXX_EXPORT __declspec(dllexport)
#   else
#       define XXX_EXPORT __declspec(dllimport)
#   endif
#else
#   if defined __SUNPRO_C  || defined __SUNPRO_CC
#       define XXX_EXPORT __global
#   elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
#       define XXX_EXPORT __attribute__ ((visibility("default")))
#   else
#       define XXX_EXPORT
#   endif
#endif


XXX_EXPORT void xxx_version (int *major, int *minor, int *patch);


#undef XXX_EXPORT

#ifdef __cplusplus
}
#endif

#endif



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值