mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-27 22:01:02 +08:00
rework header/library versioning
this replaces the changes in Issue #53 with a slightly different way of representing / retrieving the version number. protobuf_c_version() returns the version of the *library* as a string. protobuf_c_version_number() returns the version of the *library* as an integer. PROTOBUF_C_VERSION is the version of the *headers* as a string constant. PROTOBUF_C_VERSION_NUMBER is the version of the *headers* as an integer.
This commit is contained in:
parent
4d525f2fff
commit
c821ac3c83
@ -4,7 +4,6 @@ global:
|
||||
protobuf_c_default_allocator;
|
||||
protobuf_c_enum_descriptor_get_value;
|
||||
protobuf_c_enum_descriptor_get_value_by_name;
|
||||
protobuf_c_major;
|
||||
protobuf_c_message_check;
|
||||
protobuf_c_message_descriptor_get_field;
|
||||
protobuf_c_message_descriptor_get_field_by_name;
|
||||
@ -14,11 +13,12 @@ global:
|
||||
protobuf_c_message_pack;
|
||||
protobuf_c_message_pack_to_buffer;
|
||||
protobuf_c_message_unpack;
|
||||
protobuf_c_minor;
|
||||
protobuf_c_service_descriptor_get_method_by_name;
|
||||
protobuf_c_service_destroy;
|
||||
protobuf_c_service_generated_init;
|
||||
protobuf_c_service_invoke_internal;
|
||||
protobuf_c_version;
|
||||
protobuf_c_version_number;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
@ -84,8 +84,19 @@
|
||||
#define ASSERT_IS_SERVICE_DESCRIPTOR(desc) \
|
||||
assert((desc)->magic == PROTOBUF_C_SERVICE_DESCRIPTOR_MAGIC)
|
||||
|
||||
unsigned protobuf_c_major = PROTOBUF_C_MAJOR;
|
||||
unsigned protobuf_c_minor = PROTOBUF_C_MINOR;
|
||||
/* --- version --- */
|
||||
|
||||
const char *
|
||||
protobuf_c_version(void)
|
||||
{
|
||||
return PROTOBUF_C_VERSION;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
protobuf_c_version_number(void)
|
||||
{
|
||||
return PROTOBUF_C_VERSION_NUMBER;
|
||||
}
|
||||
|
||||
/* --- allocator --- */
|
||||
|
||||
|
@ -58,14 +58,6 @@
|
||||
|
||||
#define PROTOBUF_C_OFFSETOF(struct, member) offsetof(struct, member)
|
||||
|
||||
/* The version of protobuf-c you are compiling against. */
|
||||
#define PROTOBUF_C_MAJOR 0
|
||||
#define PROTOBUF_C_MINOR 16
|
||||
|
||||
/* The version of protobuf-c you are linking against. */
|
||||
extern unsigned protobuf_c_major;
|
||||
extern unsigned protobuf_c_minor;
|
||||
|
||||
#if defined(_WIN32) && defined(PROTOBUF_C_USE_SHARED_LIB)
|
||||
# ifdef PROTOBUF_C_EXPORT
|
||||
# define PROTOBUF_C_API __declspec(dllexport)
|
||||
@ -78,6 +70,39 @@ extern unsigned protobuf_c_minor;
|
||||
|
||||
PROTOBUF_C_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Get the version of the protobuf-c library. Note that this is the version of
|
||||
* the library linked against, not the version of the headers compiled against.
|
||||
*
|
||||
* \return A string containing the version number of protobuf-c.
|
||||
*/
|
||||
PROTOBUF_C_API
|
||||
const char *
|
||||
protobuf_c_version(void);
|
||||
|
||||
/**
|
||||
* Get the version of the protobuf-c library. Note that this is the version of
|
||||
* the library linked against, not the version of the headers compiled against.
|
||||
*
|
||||
* \return A 32 bit unsigned integer containing the version number of
|
||||
* protobuf-c, represented in base-10 as (MAJOR*1E6) + (MINOR*1E3) + PATCH.
|
||||
*/
|
||||
PROTOBUF_C_API
|
||||
uint32_t
|
||||
protobuf_c_version_number(void);
|
||||
|
||||
/**
|
||||
* The version of the protobuf-c headers, represented as a string using the same
|
||||
* format as protobuf_c_version().
|
||||
*/
|
||||
#define PROTOBUF_C_VERSION "1.0.0-pre"
|
||||
|
||||
/**
|
||||
* The version of the protobuf-c headers, represented as an integer using the
|
||||
* same format as protobuf_c_version_number().
|
||||
*/
|
||||
#define PROTOBUF_C_VERSION_NUMBER 1000000
|
||||
|
||||
typedef int protobuf_c_boolean;
|
||||
|
||||
typedef enum {
|
||||
|
Loading…
x
Reference in New Issue
Block a user