NuxiNL / cloudlibc

CloudABI's standard C library
BSD 2-Clause "Simplified" License
295 stars 17 forks source link

Is cloudlibc versioned in any way? #9

Closed jeking3 closed 6 years ago

jeking3 commented 6 years ago

I'm assuming that at some point calls would be added or possibly removed, and one might need preprocessor definitions to understand which version of cloudlibc is available.

I found the following in include/uv.h but that file is for event handling:

//
// Version-checking macros and functions.
//

#define UV_VERSION_MAJOR 1
#define UV_VERSION_MINOR 15
#define UV_VERSION_PATCH 0
#define UV_VERSION_IS_RELEASE 0
#define UV_VERSION_SUFFIX "cloudlibc"

#define UV_VERSION_HEX \
  (UV_VERSION_MAJOR << 16 | UV_VERSION_MINOR << 8 | UV_VERSION_PATCH)

__BEGIN_DECLS
unsigned int uv_version(void);
const char *uv_version_string(void);
__END_DECLS

Is this official versioning for the entire library?

EdSchouten commented 6 years ago

Hi James,

That's a very good question. So far we haven't had the need for adding such version information to the C library, for the reason that we always work towards having everything packaged through https://github.com/NuxiNL/cloudabi-ports in a way that it builds against the latest release of cloudlibc.

Where would you be interested in using this version information? If you want, I can add a couple of __cloudlibc_*__ definitions to one of the core header files, meaning it will be available as long as a single header file is included.

jeking3 commented 6 years ago

As a prerequisite to adding support in Boost.Random for entropy generation based on a github pull request you submitted 2 years ago, I submitted a pull request into Boost.Predef to detect CloudABI. In your pull request it looks like the API 2 years ago was different than the API as it is today, hence it would seem the need for versioning is real. The predef module would prefer to have major and minor versions, or if you are going to simply use one number for ABI versioning then I would probably just map it to the major version.

EdSchouten commented 6 years ago

Sounds good! I've just added three definitions to cloudlibc header files: __cloudlibc__ == 1, __cloudlibc_major__ == 0 and __cloudlibc_minor__ == 87. The two latter will be bumped every time I'm going to do a release from now on. If you want to access them, all you need to do is include at least one standard C header file (e.g., <stddef.h>).

Would that be sufficient?

jeking3 commented 6 years ago

Boost.Predef has been updated in https://github.com/boostorg/predef/pull/65